Display dataset in gridview (Windows C # application)

I have a DataSet on my .net client side that I want to display in a GridView. I know the syntax, but I cannot display it. Could you tell me my mistake?

 System.Windows.Forms.DataGridView myGrid = new DataGridView(); myGrid.DataSource = xmlResponse.Tables[0]; 

I know that at this point I should bind my DataSet as:

 myGrid.DataBind(); 

but I can not find this attribute in C #! All I have is DataBindings and DataBindingCompelete .

+4
source share
1 answer

Is xmlResponse in your code a data representation?

Please try this code - I used a dataset and it works.

  DataSet ds = new DataSet(); ds.ReadXml(strFileName); // strFileName is XML File path dataGridView1.DataSource = ds.Tables[0]; 
+1
source

Source: https://habr.com/ru/post/1498797/


All Articles