How do i transfer the information stored in the 2nd and 3rd col of the selected row in datagrid
im using visual basic 6

i have to transfer it to a textBox in a diferent form
please tell me if its possible

Recommended Answers

All 4 Replies

nope :(
the link u sent me refers to accesing a specific tile in datagrid
i was asking if its possilbe to acces a tile that was selected with the mouse
guess ill have to use lists :/

The following code will display a datagrid cell value ini the title bar when that cell is clicked.

    Private Sub DataGridView1_CellClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim dgv As DataGridView = DirectCast(sender, DataGridView)
        Me.Text = dgv.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
    End Sub

Are you looking for this??

    Private Sub DataGridView1_CellClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim i As Integer
        i = DataGridView1.CurrentRow.Index
        Form1.TextBox1.Text = DataGridView1.Item(1, i).Value.ToString
        Form1.TextBox2.Text = DataGridView1.Item(2, i).Value.ToString
    End Sub

Ohhh...sorry...this code is in vb.net....

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.