I found this forum very useful to me as a beginner in VB.net
and found similar thread regarding my concern unfortunately it doesn't for me may be could someone show me the solution.

http://www.daniweb.com/software-development/visual-basic-4-5-6/threads/340634/1446506#post1446506

i will provide screen shot on error I'm encountering.
[IMG]http://i54.tinypic.com/15o9mvc.jpg[/IMG]

Help much appreciated and thank you in advance!

Recommended Answers

All 5 Replies

See if this helps.

Private Sub DataGridView1_CellContentDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
        TextBox1.Text = DataGridView1.SelectedCells(0).Value.ToString
    End Sub

Btw, the code from that link is for vb6, not vb.net.

it work but all the text boxes are same value. I have 6 textbox in my form once i dclick any value cell it should be appearing in textboxes. See attacehed of my form layout: [url]http://i56.tinypic.com/2vb0izl.jpg[/url]

Here is what i want to be done.

in the datagrid a list of a remitter info. Once i click ID_num or any fields from datagrid it will the textboxes by their information.
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        TextBox1.Text = DataGridView1.CurrentRow.Cells(0).Value.ToString '// column 1.
        TextBox2.Text = DataGridView1.CurrentRow.Cells(1).Value.ToString '// column 2.
        TextBox3.Text = DataGridView1.CurrentRow.Cells(2).Value.ToString '// column 3.
        '// etc.
    End Sub

you try this:

dim i as integer
i = datagrid.CurrentRow.Index 
txtSomething.Text=datagrid(6, i).Value

thanks mates for the ideas i came up with this solution. To our mods kindly close this thread problem solved. Thank you!

Private Sub dgRemit_CellDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgRemit.CellDoubleClick
        txtR_ID.Text = dgRemit(1, e.RowIndex).Value.ToString()
        txtLname.Text = dgRemit(2, e.RowIndex).Value.ToString()
        txtFname.Text = dgRemit(3, e.RowIndex).Value.ToString()
        txtMname.Text = dgRemit(4, e.RowIndex).Value.ToString()
        txtCon.Text = dgRemit(5, e.RowIndex).Value.ToString()
        txtIDnum.Text = dgRemit(6, 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.