How To Insert Rows To DataGridView From Another Form In Visual Basic.Net
In This VB.Net Tutorial We Will See How To Add Rows To DataGridView From TextBoxes On A Different Form Using Visual Basic.Net Programming Language And Visual Studio Editor.
and in this example we will create 2 forms:
1 - form_1 with a datagridview and a Button
2 - form_2with 3 textboxes and a button
when we click in form_1 button "open a new window" the second form will show up , you need to fill up the textboxes and click the 'add' button
- To Learn More Watch The Video Tutorial Below.
and in this example we will create 2 forms:
1 - form_1 with a datagridview and a Button
2 - form_2with 3 textboxes and a button
when we click in form_1 button "open a new window" the second form will show up , you need to fill up the textboxes and click the 'add' button
- To Learn More Watch The Video Tutorial Below.
Project Source Code:
' Form DataGridView
Public Class FormGRID
' open a new form to add the data
Private Sub ButtonOpen_Click(sender As Object, e As EventArgs) Handles ButtonOpen.Click
Dim fdata As New FormDATA()
fdata.Show()
End Sub
End Class
' Form TextBoxes
Public Class FormDATA
' button add data
Private Sub ButtonAdd_Click(sender As Object, e As EventArgs) Handles ButtonAdd.Click
' add a new row with our data to the datagridview
FormGRID.DataGridView1.Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text)
End Sub
End Class
Note: make sure to set the datagridview to static (better if you watch th full video)
///////////////OUTPUT:
This Is The End Result
Post A Comment:
0 comments: