if add row to DataTable
DataRow row = datatable1.NewRow();
row["column2"]="column2";
row["column6"]="column6";
datatable1.Rows.Add(row);
How about DataGridView
??
if add row to DataTable
DataRow row = datatable1.NewRow();
row["column2"]="column2";
row["column6"]="column6";
datatable1.Rows.Add(row);
How about DataGridView
??
Like this:
Consider a Windows Application and using Button Click Event put this code in it.
But be aware,
WhichIsType
is the extension method I created.If the grid is bound against a DataSet / table its better to use a BindingSource like
If you need to manipulate anything aside from the Cell Value string such as adding a Tag, try this:
Adding a new row in a DGV with no rows with Add() raises SelectionChanged event before you can insert any data (or bind an object in Tag property).
Create a clone row from RowTemplate is safer imho: