David Svedarsky
asked on
How to add multiple rows to datagridview with butten click
Using a bound datagridview.
I need sample code to add multiple rows to a datagridview with butten click event.
I need to add 24 blank rows with one click event.
I need sample code to add multiple rows to a datagridview with butten click event.
I need to add 24 blank rows with one click event.
Since you are using a bound datagrid, just add 24 more records to the list or datatable which you are binding to the grid and do a databind again.
ASKER
I want to do this instantaneously with a button click event. Not one row at a time.
On the Buttom Click you can add all the 24 records so after the button click u would see 24 blank records.
It would appear as if all 24 were inserted. It would appear row by row
It would appear as if all 24 were inserted. It would appear row by row
ASKER
I don't really understand what you are trying to explain.
Maybe you can show me some sample code as requested in my opening question.
Maybe you can show me some sample code as requested in my opening question.
If you did DataGrid.DataSource = dtTableData;
on Button1_Click()
{
for(int i =0; i < 24; i++)
{
dtTableData.Rows.Add(DtTab leData.New Row());
}
DataGrid.DataSource = dtTableData;
}
on Button1_Click()
{
for(int i =0; i < 24; i++)
{
dtTableData.Rows.Add(DtTab
}
DataGrid.DataSource = dtTableData;
}
ASKER
I think you may have the solution but I can't convert all the C# code to VB.Net.
For index As Integer = 1 To 24
dtTable.Rows.Add(dtTable.N ewRow())
Next
dgrid.DataSource = dtTable
dtTable.Rows.Add(dtTable.N
Next
dgrid.DataSource = dtTable
ASKER
I'm not familiar with your code.
Can you complete this?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
???????????
End Sub
DataGridview: TblJobOrdersDetailDataGrid View
Table: TblJobOrdersDetail
DataSet: MonarhSQL
Can you complete this?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
???????????
End Sub
DataGridview: TblJobOrdersDetailDataGrid
Table: TblJobOrdersDetail
DataSet: MonarhSQL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
surajguptha,
This works good.
Thank you.
This works good.
Thank you.