Is it possible to replace an entire DataGridViewRow value in one line of code?
Dim dgvR As DataGridViewRow = dgvExcelData.Rows(i)
'[...]
Dim row As String() = New String() {a,b,c,d,e}
I don't want to replace like this:
dgvR.Cells("xxx").Value = a
Is it possible to replace an entire DataGridViewRow value in one line of code?
Dim dgvR As DataGridViewRow = dgvExcelData.Rows(i)
'[...]
Dim row As String() = New String() {a,b,c,d,e}
I don't want to replace like this:
dgvR.Cells("xxx").Value = a
You can use the DataGridViewRow.SetValues method.
It accepts an object[]:
dataGridView1.Rows[1].SetValues(new object[] { 1, "2", 3.01D, DateTime.Now, null });
This object array can also be set when the DataGridView is bound to a DataSource.
Make sure the objects in the array correspond to each Cell's ValueType.