Question Locked

combobox and textbox question

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a combobox in VB 2005 that contains a list of two character numbers and letters. I also have a locked textbox that i have set so it can not be changed. I am trying to get the program to show me when A1 is selected in the combo box, the textbox displays an associated name. I am newer to programming so any help would be wonderful!

2 replies

by tony hopkinson

For OnSelectedIndexChange (or SelectedItemChange)

If the displayed text is you look up key.

Then Combobox1.SelectedItem.ToString();
should give you that. Do your lookup and then set the textBox's Text property to the content.

Hths

PS take into account there could be nothing selected in the ComboBox

SelectedIndex < 0
SelectedItem = Nothing.

C# guy, so excuse the VB syntax.

This discussion is closed to new replies.