Imar,
Finally found this forum. I took your advice from 2004 and the above conversation. I created an object with "Description" and "Value" properties. Then I loaded these objects from an ENUM which contains text like ICE_Ice_And_Rain and populated the ComboBox with these. Still couldn't get the ComboBox to display "Value" after "Description" was selected so I CHEATED. I covered the ComboBox edit area with a TextBox which behaved as desired (I'm a student programer, and was totally frustrated after three days on this problem).
Here's code from LOAD.
Names = [Enum].GetNames(GetType(SystemNames.Systems))
For i = 0 To Names.Length - 1
BrokenUp = Names(i).Split("_")
For j = 1 To BrokenUp.Length - 1
Description = Description & BrokenUp(j) & " "
Next j
Value = BrokenUp(0)
cboSystems.Items.Add(New SystemNames(Description, Value))
cboSystems.DisplayMember = "Description"
Description = ""
Next i
Then the DropDownClosed code.
If cboSystems.SelectedIndex = -1 Then Exit Sub
txtSystems.Visible = True
txtSystems.Text = CType(sender.selecteditem, SystemNames).Value
Finally the TextBox GotFocus() code.
txtSystems.Visible = False
cboSystems.Focus()
cboSystems.Text = " " & txtSystems.Text
Thanks again,
Bill
|