Hello people, I've got a problem. Can anybody tell me how can I save data from DataGridView through Dataset to XML? I've found many useful codes that could solve problem like this:

Dataset ds = new Dataset();

ds = (Dataset) (DataGridViewXY.Datasource);


!but actually! it doesn't work because when I run program it all stops at ds = (Dataset) (DataGridViewXY.Datasource); saying something like cannot assign Dataset to DataGridView...

What can I do? Isn't there problem that my DataGridView data are bound? How can I change this property/option?

Any hints?


If your datagrid has a datasource you could just try calling its writeXML function, if it doesnt have one, then this could be more interesting in that you should try creating one and assigning it with all the properties for your dataset on creation and then you could call the writeXML later.