I am new to c#, this may be very easy question.
In my application there is a Form in which I have datagridview dgvBill and a Button btnClick. I declared columns to it by clicking the extender and selecting add columns. After executing the form, I written some text to each column in dgvBill. When I click on btnClick it is creating an xml file but with no data in it. (why the data is not being added ?)
The created XML file looks like this:
<?xml version="1.0" standalone="yes"?>
<NewDataSet />
I have tried the below code:
btnClick Event
DataSet ds = new DataSet();
ds.WriteXml(@"..\..\Customer_Info\" + lblCustId.Text + ".xml");
dgvBill.DataSource = ds; /* also tried ds.Tables[0] */
lblCustId is a label in the Form
Optional: can I make each cell of datagridview into ComboBox?
Thanks in advance.
My problem solved when I created a new empty xml file (which has only created column names)
and read the xml file in a dataset object (on form load event). I used the same dataset object to write on different xml file (on button click event). I am sure that this is not the correct way but it worked. Please post here if you have any other good suggestions.