In this post we have fully learned how to add textbox value of DataGridView. This is a very simple task for which we have to select a number of Textbox, a number of DataGridView from Tool Box. Next, we need to create a SQL Server database. It has to create a number table and custom columns. After that it has to be used as per below coding video. This coding is required by us for many software. Like database management software etc.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Ad55 As Integer = DataGridView1.Rows.Add()
DataGridView1.Rows.Item(Ad55).Cells("Column1").Value = TextBox1.Text
DataGridView1.Rows.Item(Ad55).Cells("Column2").Value = TextBox2.Text
DataGridView1.Rows.Item(Ad55).Cells("Column3").Value = TextBox3.Text
DataGridView1.CurrentCell = DataGridView1(0, DataGridView1.Rows.Count - 1)
Dim totalll As Decimal = 0
For Each row As DataGridViewRow In DataGridView1.Rows
totalll += row.Cells("Column3").Value
Next
TextBox4.Text = totalll.ToString("0.00")
End Sub
End Class
How to delete DataGridView rows
For Each row As DataGridViewRow In DataGridView1.SelectedRows
DataGridView1.Rows.Remove(row)
Next