Home All Groups Group Topic Archive Search About

Can I bind DataGridView to xml?

Author
31 Jan 2006 7:52 PM
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

Author
1 Feb 2006 8:38 AM
Dmytro Lapshyn [MVP]
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.

Show quote
"Stan" <nospam@yahoo.com> wrote in message
news:eOQ%23y%23pJGHA.1728@TK2MSFTNGP09.phx.gbl...
>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
>
>
>

AddThis Social Bookmark Button