I have build a WindowForm application that has a combobox which has a Data Binding Mode to a View on SQL Database and textbox.
The View query: "SELECT [CompanyName],CountryName FROM [CompanyRefTable]"
The members of the combobox are as follow: DataSource: CDALLENTITIESLISTBindingSource DisplayMember:CompanyName ValueMember: CompanyName SelectedValue: CompanyName
I have done some modifications to the code (updated on page)
Now Im getting the values from the second column:)
My code:
Dim rowView As DataRowView = TryCast(Me.cmbEntity.SelectedItem, DataRowView)
If (Not rowView Is Nothing) Then
Dim row As DataRow = rowView.Row
Dim subjectName As String = DirectCast(row.Item("CountryName"), String)
Me.txtCountry.Text = subjectName.ToString
End If
Thank you for your help!