write datagridview data in to xml file

Mr.NT

New Member
I am new to c#, this may be very easy question.In my application there is a \[code\]Form\[/code\] in which I have datagridview \[code\]dgvBill\[/code\] and a Button \[code\]btnClick\[/code\]. I declared columns to it by clicking the extender and selecting \[code\]add columns\[/code\]. After executing the form, I written some text to each column in \[code\]dgvBill\[/code\]. When I click on \[code\]btnClick\[/code\] 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:\[code\]<?xml version="1.0" standalone="yes"?><NewDataSet />\[/code\]I have tried the below code:btnClick Event\[code\]DataSet ds = new DataSet();ds.WriteXml(@"..\..\Customer_Info\" + lblCustId.Text + ".xml");dgvBill.DataSource = ds; /* also tried ds.Tables[0] */\[/code\]\[code\]lblCustId\[/code\] is a label in the \[code\]Form\[/code\]Optional: can I make each cell of datagridview into ComboBox?Thanks in advance.
 
Back
Top