How to use DataGrid ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marty

    #1

    How to use DataGrid ?

    Hi,

    How do I set rows/colums, titles and data in the DataGrid control of
    VB.NET. I don't want to pass through a dataset and use databinding. I
    want to set this grid manually.

    Is there any tutorial for that?

    Thanks

    Marty


  • Arun Chopra

    #2
    RE: How to use DataGrid ?

    Well Marty,
    You can use the Tablestyle Collections for the Same. Here when you click the
    datagrid and see its properties there you set the Tablestyle properties.

    Or you can also use it in code like the code example listed below

    Dim tableStyle As New DataGridTableSt yle
    tableStyle.Mapp ingName = "Grouping"

    Dim column As New DataGridTextBox Column
    column.MappingN ame = "Group_Code "
    column.HeaderTe xt = "Code"
    column.Width = 70
    tableStyle.Grid ColumnStyles.Ad d(column)

    column = New DataGridTextBox Column
    column.MappingN ame = "Descriptio n"
    column.HeaderTe xt = "Descriptio n"
    column.Width = 200
    tableStyle.Grid ColumnStyles.Ad d(column)

    column = New DataGridTextBox Column
    column.MappingN ame = "Remarks"
    column.HeaderTe xt = "Remarks"
    column.Width = 100
    tableStyle.Grid ColumnStyles.Ad d(column)

    Me.DataGrid1.Ta bleStyles.Add(t ableStyle)

    "Marty" wrote:
    [color=blue]
    > Hi,
    >
    > How do I set rows/colums, titles and data in the DataGrid control of
    > VB.NET. I don't want to pass through a dataset and use databinding. I
    > want to set this grid manually.
    >
    > Is there any tutorial for that?
    >
    > Thanks
    >
    > Marty
    >
    >
    >[/color]

    Comment

    • Marty

      #3
      Re: How to use DataGrid ?

      Great, thanks you.



      Arun Chopra wrote:
      [color=blue]
      > Well Marty,
      > You can use the Tablestyle Collections for the Same. Here when you click the
      > datagrid and see its properties there you set the Tablestyle properties.
      >
      > Or you can also use it in code like the code example listed below
      >
      > Dim tableStyle As New DataGridTableSt yle
      > tableStyle.Mapp ingName = "Grouping"
      >
      > Dim column As New DataGridTextBox Column
      > column.MappingN ame = "Group_Code "
      > column.HeaderTe xt = "Code"
      > column.Width = 70
      > tableStyle.Grid ColumnStyles.Ad d(column)
      >
      > column = New DataGridTextBox Column
      > column.MappingN ame = "Descriptio n"
      > column.HeaderTe xt = "Descriptio n"
      > column.Width = 200
      > tableStyle.Grid ColumnStyles.Ad d(column)
      >
      > column = New DataGridTextBox Column
      > column.MappingN ame = "Remarks"
      > column.HeaderTe xt = "Remarks"
      > column.Width = 100
      > tableStyle.Grid ColumnStyles.Ad d(column)
      >
      > Me.DataGrid1.Ta bleStyles.Add(t ableStyle)
      >
      > "Marty" wrote:
      >
      >[color=green]
      >>Hi,
      >>
      >>How do I set rows/colums, titles and data in the DataGrid control of
      >>VB.NET. I don't want to pass through a dataset and use databinding. I
      >>want to set this grid manually.
      >>
      >>Is there any tutorial for that?
      >>
      >>Thanks
      >>
      >>Marty
      >>
      >>
      >>[/color][/color]


      Comment

      • Cor Ligthert

        #4
        Re: How to use DataGrid ?

        Marty,[color=blue]
        > How do I set rows/colums, titles and data in the DataGrid control of
        > VB.NET. I don't want to pass through a dataset and use databinding. I
        > want to set this grid manually.[/color]

        You cannot, that is why the name is DataGrid and not Grid, it needs an
        underlaying datasource.

        (Which has not to be a table from a database by the way)

        I hope this gives an idea?

        Cor


        Comment

        Working...