Im trying to display data in a datagrid then once a row is selected show a different column of the database in a text box. I use the unique primary key in the datagridview as not visible so once the row is selected, i can get that integer and populate the textbox by using another database query. Of course if there is a way to show the data in the textbox without needed to query the db again that would be great. Could someone please let me know how to get the selected row? Also the rows in the datagridview is set to select the entire row not just a cell if that makes a difference
StatiX
0
Light Poster
Recommended Answers
Jump to Posthi,
Use the below coding:
Private Sub upload_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sqlcn As New SqlConnection("server=shailu;uid=sa;pwd=;database=master;") Dim sadapt As New SqlDataAdapter("select * from abcd", sqlcn) Dim ds As DataSet = New DataSet sadapt.Fill(ds, "abcd") DataGridView1.DataSource = ds.Tables("abcd") End Sub Private …
All 13 Replies
manoshailu
12
Junior Poster
tanmoy_mistri
commented:
Thanks a lot.
+0
StatiX
0
Light Poster
salman.malik
0
Newbie Poster
pixma
commented:
this code doesn't work
+0
deepak_itprof83
0
Newbie Poster
c0deFr3aK
1
Junior Poster in Training
zunaidius
0
Newbie Poster
gkdada67
0
Newbie Poster
srk_india2008
0
Newbie Poster
jhpajiri
0
Newbie Poster
Rohini2801
0
Newbie Poster
manoshailu
12
Junior Poster
vorauo
0
Newbie Poster
gever
0
Newbie Poster
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.