I have a wpf application which has combo box and multiple text boxes.
On the window load event the combo box is filled with the Employee IDs. When I select any ID then the below text boxes should display the name, city, zip, country of the selected “Id”.
I did wrote the below code for filling in the values in text boxes.
Private Sub dataview1(ByVal GUID As String)
Try
Dim viewDs As New DataSet()
Dim Query As String
Query = "Select * from tblEmployeeInfo Where ID = '" & GUID.Trim & "'"
viewDs = GetData(Query, True)
Dim dv As DataView = New DataView(viewDs.Tables(0))
Dim Notify As String = String.Empty
If dv.Count > 0 Then
If Not IsDBNull(dv(0)("ID")) Then
txtGUID.Text = dv(0)("ID")
Else
txtGUID.Text = String.Empty
End If
If Not IsDBNull(dv(0)("StreetName")) Then
txtStName.Text = dv(0)("StreetName")
Else
txtStName.Text = String.Empty
End If
End If
Catch ex As Exception
MsgBox("No Values Found")
End Try
End Sub
And called the above function on Selection Changed Event of Combo Box as below:
Private Sub ID CB_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs) Handles IDCB.SelectionChanged
StreetCB.IsEnabled = False
DataView1(IDCB.SelectedItem)
Though it hits the ViewMode Function but it never populates any values in my text boxes.
Am I missing any thing in it?
Is there any way I could achieve?
Any help will be much appreciated.
Thank you so much!
Step through this in the debugger. This could happen if your query returns no results, which is, I suspect, the issue in this case.