You must Sign In to post a response.
Category: Windows
#265893
DataRow dr;
DataSet ds; // this is bound to DataGridView
// some logic setting up dataset and tables within
dr = ds.Tables[0].NewRow(); // Table[0] of ds is the data I want to display
dr["Column1"] = "Finally";
dr["Column2"] = "Got";
dr["Column3"] = "this";
dr["Column4"] = "Working";
// add row to dataset now
ds.Tables[0].Rows.Add(dr);
Regards,
M.Venkatesan.
For Interview Question and Answers:
http://dotnet-interview-qa.blogspot.com
http://venkatdotnetexperiments.wordpress.com
DataSet ds; // this is bound to DataGridView
// some logic setting up dataset and tables within
dr = ds.Tables[0].NewRow(); // Table[0] of ds is the data I want to display
dr["Column1"] = "Finally";
dr["Column2"] = "Got";
dr["Column3"] = "this";
dr["Column4"] = "Working";
// add row to dataset now
ds.Tables[0].Rows.Add(dr);
Regards,
M.Venkatesan.
For Interview Question and Answers:
http://dotnet-interview-qa.blogspot.com
http://venkatdotnetexperiments.wordpress.com
#293463
We can also add empty rows in datagridview
using this code....
da.Fill(ds, <sourceTable>);
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
string columnName= ds.Tables[0].Columns[i].ColumnName;
gridView.Columns.Add(columnName,columnName.ToUpper());
}
gridView.Rows.Add(10);
using this code....
da.Fill(ds, <sourceTable>);
for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
{
string columnName= ds.Tables[0].Columns[i].ColumnName;
gridView.Columns.Add(columnName,columnName.ToUpper());
}
gridView.Rows.Add(10);
Return to Return to Discussion Forum