Results 1 to 6 of 6

Thread: Datagrid ds.table(0)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    22

    Datagrid ds.table(0)

    How can I get ride off the dataset table name from showing in datagrid.

    I have to click the "table" link in order to see my datagrid.rows.
    I have tried a few grid properties ( grd.ParentRowsVisible = False; grd.Expand(-1)), but no luck.

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    Set the DataMember property of the Datagrid to the table name.
    VB Code:
    1. grd.DataMember = "Table_Name"

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    22
    Thank you wey97.

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    I think it's a lot easier to use a DataTable instead of a DataSet...
    VB Code:
    1. Dim con as New Connection(...)
    2. Dim ad as New DataAdapter("SELECT * FROM...", con)
    3. Dim dt as New DataTable
    4.  
    5. ad.Fill(dt)
    6. grd.DataSource = dt
    and you're done.

  5. #5
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    What are the benefits of a datatable over a dataset?

  6. #6
    Frenzied Member
    Join Date
    Aug 2000
    Location
    Birmingham, AL
    Posts
    1,276
    Originally posted by Hole-In-One
    What are the benefits of a datatable over a dataset?
    None other than not having to remember to set the DataMember of the DataGrid which there has been a lot of confusion over.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width