windows form datagrid question

J

Jason Huang

Hi,

In my Window Form, my DataGrid1 uses DataTable MyDT as it's DataSource.
Now MyDT has 3 columns, after the following Column.Add commands,
"Column1","Column2", and "Column3".
MyDT.Columns.Add("Column1");
MyDT.Columns.Add("Column2");
MyDT.Columns.Add("Column3");
How do I add a DataRow into MyDT?
Thanks for help.


Jason
 
G

Guest

Hi,

To add datarow:

DataRow r = MyDT.NewRow();
r["Column1"] = "xxx";
r["Column2"] = "xxx";
r["Column3"] = "xxx";
MyDT.Rows.Add(r);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top