I am new in Vb.net and I am still studying this language.
I am trying to retrive data to a textbox from a datagridview.
I have Tabcontrol with two tabs naming Data Sheet View and Form View.
The datagridview is in Data Sheet view while my textboxes are in Form View.
Al I want is that everytime I click on the data in datagridview, it would display in textbox in form view.
Here are some of my code:
Dim ret As String = "select * from newstudent_tbl where USN='" & DataGridView1.SelectedCells(0).ToString & "'" cmd.CommandText = ret cmd.Connection = oConn oConn.Open() dr = cmd.ExecuteReader If dr.HasRows Then Do While dr.Read TextBox2.Text = dr(0) TextBox4.Text = dr(1) Loop End If oConn.Close() cmd.Dispose() oConn.Dispose()
Can you help me guys solve this problem??
thanks in advance!