Guyz I need help.. I'm a newbie in vb.net 2008..I have a form for User Account Maintenance and I want to transfer the Data of the specified Cell of the Datagridview once it's selected by clicking the mouse. How can I transfer it to textbox? Please help me.

Recommended Answers

All 2 Replies

Guyz I need help.. I'm a newbie in vb.net 2008..I have a form for User Account Maintenance and I want to transfer the Data of the specified Cell of the Datagridview once it's selected by clicking the mouse. How can I transfer it to textbox? Please help me.

DataGridView has an event called CellClick.
You can use that to extract the value of the cell you clicked.
Ex:

Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles dgv.CellClick
        txtBox.Text = dgv.Item(e.ColumnIndex, e.RowIndex).Value.ToString
    End Sub

Thanx!It was very useful.. It really help me..

DataGridView has an event called CellClick.
You can use that to extract the value of the cell you clicked.
Ex:

Private Sub dgv_CellClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles dgv.CellClick
        txtBox.Text = dgv.Item(e.ColumnIndex, e.RowIndex).Value.ToString
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.