3
Contributors
5
Replies
11
Views
6 Years
Discussion Span
Last Post by khean
0

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.

Edited by codeorder: n/a

0
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.

Edited by khean: n/a

0
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
0

you try this:

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

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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.