DataGridView and DataSet

Hello, i'm trying to connect DataSet to DataGridView in Whidbey beta 1, but no data are displayed. If i connect DataSet to old DataGrid, i see '+', then table and all rows. But DataGridView seems empty. Can anyone tell me, where is problem

DataSet ds = new DataSet();
ds = ... Web Service Method
dataGridView.DataSource = ds;


Answer this question

DataGridView and DataSet

  • Kfink04

    dataGridView.DataSource = ds.Tables(0)
  • sanaryans

    Yes, it's all true, but i think there is something wrong with DataGridView in beta 1, because this grid doesn't show any data if only dataset is attached. Whena i attach dataset to old datagrid, automaticly is displayed dataset content. But when i do the same thing with datagridvie, nothing is displayed. Yes, when i select table in design, so all is ok, columns are visible, but it's only the way how to do this.

    Does anyone tried just attach full dataset  Nothing more. I want to know if i am wrong or datagridview is not final for now.

  • richardjohnsen

    Well this can help, but i need to display unknow table from web service, so in old DataGrid is displayed "plus", when i click on it, this will expand table view and next table data. It work without setting DataMember property, so i think new DataGridView can display that too.
  • Adrianagoni


    That's not supported on the DataGridView - you need to provide a table name (DataMember) when binding to a DataSet.

    Joe

  • Logicboy

    You can get your table count by: 
      oDs.Tables.count

    You can get your table name from:
      oDs.Tables(0).TableName

  • ellenf


    Try setting DataMember to the table name.

  • DataGridView and DataSet