This is my code;
Dim TMID As Integer = -1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TMID = TMID + 1
If TMID > 0 Then
Form2.DataGridView1.Rows.Add()
End If
Form2.DataGridView1.Rows(TMID).Cells(0).Value = TMID + 1
Form2.DataGridView1.Rows(TMID).Cells(1).Value = Me.TextBox1.Text
Form2.DataGridView1.Rows(TMID).Cells(2).Value = "-"
Form2.DataGridView1.Rows(TMID).Cells(3).Value = "-"
Form2.DataGridView1.Rows(TMID).Cells(4).Value = Me.TextBox2.Text
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
End Sub
End Class
After clicking some time on Button1 (Add Button) it will look like this; http://i.imgur.com/Bdouvhp.png
I'm new to VB.net :(
Check out the DataGridView.Rows
property on MSDN
You can add all the items of the row at once like so
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TMID = TMID + 1
Form2.DataGridView1.Rows.Add(TMID + 1, "test", "-", "-", "Test")
End Sub
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments