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
Jump to Post
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 RepliesReply to this topic
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.