add row to datagridview c# add rows to datagridview

The solution for “add row to datagridview c# add rows to datagridview” can be found here. The following code will assist you in solving the problem.

DataGridViewRow row = (DataGridViewRow)yourDataGridView.Rows[0].Clone();
row.Cells[0].Value = “XYZ”;
row.Cells[1].Value = 50.2;
‘Add rows
Me.DataGridView1.Rows.Add(TextBox1.Text) ‘TextBox1 = data being added to grid

‘Remove rows

‘making sure the user has chosen a row
If DataGridView1.SelectedRows.Count > 0 Then
For i As Integer = DataGridView1.SelectedRows.Count – 1 To 0 Step -1
MsgBox(“No row(s) have been selected”)
End If

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts