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 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. 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. 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. TextBox4.Text = DataGridView1.Item(3, i).Value TextBox3.Text = DataGridView1.Item(2, i).Value TextBox2.Text = DataGridView1.Item(1, i).Value TextBox1.Text = DataGridView1.Item(0, i).Value Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As ) Handles DataGridView1.CellClick Use the below coding: Private Sub upload_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loadĭim sqlcn As New SqlConnection("server=shailu uid=sa pwd= database=master ")ĭim sadapt As New SqlDataAdapter("select * from abcd", sqlcn)ĭataGridView1.DataSource = ds.Tables("abcd")
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |