Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Column1 As DataGridViewTextBoxColumn = New DataGridViewTextBoxColumn()
Column1.Name = "Column1"
Column1.HeaderText = "Column1"
Dim Column2 As DataGridViewTextBoxColumn = New DataGridViewTextBoxColumn()
Column2.Name = "Column2"
Column2.HeaderText = "Column2"
DataGridView1.Columns.Add(Column1)
DataGridView1.Columns.Add(Column2)
End Sub
Private Sub AddButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddButton.Click
Dim NewRow As DataGridViewRow = New DataGridViewRow()
Dim Cell1 As DataGridViewCell = New DataGridViewTextBoxCell()
Dim Cell2 As DataGridViewCell = New DataGridViewTextBoxCell()
Cell1.Value = "Test1"
Cell2.Value = "Test2"
NewRow.Cells.Add(Cell1)
NewRow.Cells.Add(Cell2)
DataGridView1.Rows.Add(NewRow)
End Sub
End Class