I am using VB.NET 2010 and having an issue with selecting the appropriate item in the combobox programmatically with info from the data base. The combobox contains the following items:
AAA
AA
A
B
C
D
I have verified that there are no leading or trailing spaces in the combobox items.
When the record in the database contains "A", the FindString finds the AAA record. If the database contains "B", "C" or "D", it finds the correct item.
Here is my code that gives an index of 0 to show "AAA:
Change "A" to "B" and the index is now 3 which is correct.
The user requires the combobox items to be listed in the order stated.
Any suggests are greatly appreciated!
AAA
AA
A
B
C
D
I have verified that there are no leading or trailing spaces in the combobox items.
When the record in the database contains "A", the FindString finds the AAA record. If the database contains "B", "C" or "D", it finds the correct item.
Here is my code that gives an index of 0 to show "AAA:
Code:
lblSingles.Text = "A" ' Simulate data from database
Dim index As Integer
index = cboSingles.FindString(lblSingles.Text)
cboSingles.SelectedIndex = index
Change "A" to "B" and the index is now 3 which is correct.
Code:
lblSingles.Text = "B" ' Simulate data from database
Dim index As Integer
index = cboSingles.FindString(lblSingles.Text)
cboSingles.SelectedIndex = index
The user requires the combobox items to be listed in the order stated.
Any suggests are greatly appreciated!