In my windows form, I have a combo box which is populated with (part code)values from my database and I'm finding it hard to set each equivalent (part name)value to a text box which is in the same table. I was able to populate combo box values using the code below but I cannot work on text box field. Can anyone help with this? Thank you in advance. :)
If cmbProcess.SelectedIndex = "0" Then
Try
con.Open()
Dim strSQL As String
strSQL = "select PartCode from tblINKPROCESSING"
Dim da As New SqlDataAdapter(strSQL, con)
Dim ds As New DataSet
da.Fill(ds, "tblINKPROCESSING")
With cmbPCode
.DataSource = ds.Tables("tblINKPROCESSING")
.DisplayMember = "PartCode"
.ValueMember = "PartCode"
.SelectedIndex = -1
End With
Catch ex As Exception
MessageBox.Show("Error while connecting to SQL Server." & ex.Message)
Finally
con.Close()
End Try
End If