0

Hey,
Im pretty new to coding in vb.net 2008.
I'm creating a little application that has a datagridview, i have set up the database link with the built in interface and got the database showing in the datagridview.
I want to be able to click on a row and it displays the information in text boxes on the same form (will transfer to another form afterwards)
I haven't a clue how to do this, there is no coding on the form for the database connection so can't look at that to figure it out.
If anyone can point me in the right direction i would greatly appreciate it,
thanks
Baggy

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by dlplenin
0

hi.
If I underdant...you have 2 options:

1) In each textbox you have to select the propierty: (Databindings) > Text and choose as you need.

(see the attach)

2) in the event cellClick

Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Me.TextBox2.Text = Me.DataGridView1.CurrentRow.Cells(0).Value
        Me.TextBox3.Text = Me.DataGridView1.CurrentRow.Cells(1).Value
        Me.CheckBox2.Checked = Me.DataGridView1.CurrentRow.Cells(1).Value
    End Sub

in the lines 2 to 4 are asigned the values of the currect row in the textBoxes... the value of Cells() is the index of the column.


I hope this help you....(sorry, my english is not good)

Attachments DibujoGT.jpg 105.38 KB
This topic has been dead for over six months. 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.