Posted by: Sourav | June 1, 2015

Get data in textbox when click on gridview,VB.Net


 Private Sub DataGridView4_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView4.CellContentClick
If e.RowIndex >= 0 Then
Dim row As DataGridViewRow
row = Me.DataGridView4.Rows(e.RowIndex)
TextBox10.Text = (row.Cells(“ID”).Value.ToString)
TextBox11.Text = (row.Cells(“Name”).Value.ToString)
TextBox12.Text = (row.Cells(“Age”).Value.ToString)
TextBox13.Text = (row.Cells(“Username”).Value.ToString)
TextBox14.Text = (row.Cells(“Password”).Value.ToString)
If (row.Cells(“Active”).Value.ToString) = True Then
CheckBox2.Checked = True
Else
CheckBox2.Checked = False

End If
End If
End Sub

    Private Sub DataGridView4_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView4.CellClick
        If e.RowIndex >= 0 Then
            Dim row As DataGridViewRow
            row = Me.DataGridView4.Rows(e.RowIndex)
            TextBox10.Text = (row.Cells(“ID”).Value.ToString)
            TextBox11.Text = (row.Cells(“Name”).Value.ToString)
            TextBox12.Text = (row.Cells(“Age”).Value.ToString)
            TextBox13.Text = (row.Cells(“Username”).Value.ToString)
            TextBox14.Text = (row.Cells(“Password”).Value.ToString)
            If (row.Cells(“Active”).Value.ToString) = True Then
                CheckBox2.Checked = True
            Else
                CheckBox2.Checked = False

            End If
        End If
    End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: