📌  相关文章
📜  将行添加到 datagridview vb.net - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:55.954000             🧑  作者: Mango

代码示例1
'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
        DataGridView1.Rows.RemoveAt(DataGridView1.SelectedRows(i).Index)
    Next
Else
    MsgBox("No row(s) have been selected")
End If