VB.NET - How To Insert A Row To DataGridView From TextBox Using VB.NET
In This VB.NET Tutorial We Will See How To Add a Row To DataGridView Using TextBoxes Using VB.NET Programming Language.
Project Source Code:
Imports System.Data.DataTable
Public Class Add_Row_To_DataGridView_Using_TextBoxes
' Create a new datatable
Dim table As New DataTable("Table")
Private Sub Add_Row_To_DataGridView_Using_TextBoxes_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Add columns to your datatable,
' with the name of the columns and their type
table.Columns.Add("Id", Type.GetType("System.Int32")) table.Columns.Add("First Name", Type.GetType("System.String")) table.Columns.Add("Last Name", Type.GetType("System.String")) table.Columns.Add("Age", Type.GetType("System.Int32"))
' now set the datagridview datasource equals to your datatable name
DataGridView1.DataSource = table End Sub Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
' Add rows to the datatable using textboxes
table.Rows.Add(TextBoxID.Text, TextBoxFN.Text, TextBoxLN.Text, TextBoxAGE.Text)
' now set the datagridview datasource again
DataGridView1.DataSource = table
End Sub
End Class
///////////////OUTPUT:
VB.NET - Adding Rows To DataGridView From TextBoxes
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :