Programming for Everybody: Select row datagridview vb.net

Select row datagridview vb.net

Imports System.Data
Imports System.Data.OleDb
Imports System.Data.DataTable
Public Class form2
ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ

 Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
 Dim table As New DataTable("table")
    Dim index As Integer
        index = e.RowIndex
        Dim selectedrow As DataGridViewRow
        selectedrow = DataGridView1.Rows(index)
        TextBox1.Text = selectedrow.Cells(0).Value.ToString
        TextBox2.Text = selectedrow.Cells(1).Value.ToString
        TextBox3.Text = selectedrow.Cells(2).Value.ToString
        TextBox4.Text = selectedrow.Cells(3).Value.ToString

    End Sub

No comments:

Post a Comment