Can I bind DataGridView to xml?

  • Thread starter Thread starter Stan
  • Start date Start date
S

Stan

I need DataGridView to display xml data with the ability of insert delete
and update xml back.

It is pretty easy to populate DataGridView programatically

===
grdMain.ColumnCount = 2;
grdMain.Columns[0].Name = "Release Date";
grdMain.Columns[1].Name = "Track";

string[] row0 = { "11/22/1968", "29" };
string[] row1 = { "4/4/1960", "6" };

DataGridViewRowCollection rows = grdMain.Rows;
rows.Add(row0);
rows.Add(row1);
===

somthing like that...

But is there a better way?

For example, I can load xml to a DataSet and then bind DataGridView to the
DataSet, etc...



Thanks,

-Stan
 
Hi Stan,
For example, I can load xml to a DataSet and then bind DataGridView to the
DataSet, etc...

This seems to be the simplest way. I am not sure about new features of
DataGridView as compared to DataGrid in .NET 1.1 (may be 2.0 introduces
advanced data binding), but that's the way I'd choose off the top of my
head.

Stan said:
I need DataGridView to display xml data with the ability of insert delete
and update xml back.

It is pretty easy to populate DataGridView programatically

===
grdMain.ColumnCount = 2;
grdMain.Columns[0].Name = "Release Date";
grdMain.Columns[1].Name = "Track";

string[] row0 = { "11/22/1968", "29" };
string[] row1 = { "4/4/1960", "6" };

DataGridViewRowCollection rows = grdMain.Rows;
rows.Add(row0);
rows.Add(row1);
===

somthing like that...

But is there a better way?

For example, I can load xml to a DataSet and then bind DataGridView to the
DataSet, etc...



Thanks,

-Stan
 
Back
Top