vb.net access value in combo box
-
In a VB.net 2010 desktop application, I just added 2 combo boxes to the desktop. The first combo box lists the name of the various users. The first combo box that lists the names of various users has the following values added to the collection: 'ANN','KARON'. The second combo box lists the names of Access 2013 database files that the user has access to. I have the following code:
cboUser.SelectedIndex = 0
Dim dirAccessFiles As String() = Directory.GetFiles("H:\FilesTest", "*.accdb")
Dim list As New List(Of String)()
For Each dir As String In dirAccessFiles
If String.Equals(Path.GetFileNameWithoutExtension(dir).Substring(0, 3), cboUser.SelectedValue) Then
list.Add(Path.GetFileNameWithoutExtension(dir))
End If
Nextlist.Sort() For i As Integer = list.Count - 1 To 0 Step -1 cboAccessFile.Items.Add(list(i)) Next
In the following line of code, "If String.Equals(Path.GetFileNameWithoutExtension(dir).Substring(0, 3), cboUser.SelectedValue)" , The cboUser.SelectedValue has nothing in it. However I know the collection has something in it since I can see the values in the collection of the combo box. Thus can you tell me how to change the code so that the value of 'ANN' can be located in the if statement I just listed above?