DataGridView in VB.NET
1. Create New Project
2. Drag and Drop the DataGridview from toolbox
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Insert Data in DataGridView
Me.DataGridView1.Rows.Add(nameTextBox.Text, rollnoTextBox.Text, branchComboBox.SelectedItem, cityListBox.SelectedItem)
End Sub
Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
'Retrieve data from DataGridView and show it in textboxes
nameupdateTextBox.Text = Me.DataGridView1.CurrentRow.Cells(0).Value
rollnoupdateTextBox.Text = Me.DataGridView1.CurrentRow.Cells(1).Value
branchupdateTextBox.Text = Me.DataGridView1.CurrentRow.Cells(2).Value
cityupdateTextBox.Text = Me.DataGridView1.CurrentRow.Cells(3).Value
End Sub
Private Sub updateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updateButton.Click
'Update Data in DataGridView
Me.DataGridView1.CurrentRow.Cells(0).Value = nameupdateTextBox.Text
Me.DataGridView1.CurrentRow.Cells(1).Value = rollnoupdateTextBox.Text
Me.DataGridView1.CurrentRow.Cells(2).Value = branchupdateTextBox.Text
Me.DataGridView1.CurrentRow.Cells(3).Value = cityupdateTextBox.Text
End Sub
Private Sub deleteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles deleteButton.Click
'Delete Selected Row
Me.DataGridView1.Rows.Remove(Me.DataGridView1.CurrentRow)
End Sub
End Class
Njoy!!!!!
TING LAK LAK TING TING LAK LAK!!!!!!!!!!!!!!!!!!!






Sir ,
What are you trying to tell in this article , we do not get much idea what this article is really about except that
it is about the Data Gridview .. and what
else you are trying to do with in article
Please Try write few lines before you write complete article .
Thanks
Sanjeev
Reply to this