Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box has text in it after being cleared

Status
Not open for further replies.

tmcnutt

Programmer
May 17, 2002
83
US
Here is a simple set up with the problem that I am having with combo boxes. I have form1 that is the main form and it calls form2 which has a checkbox that enables a group box which contains a combo box and a few other controls. If I populate the combo box and then decide to clear the checkbox then all the controls in the group box are cleared and disabled. I then hide form2 and go back to form1. When I go to form2 the controls are disabled, but the combo box has the item that was selected before it was cleared in it. I set the text property to "" to clear it because if the user enters text instead of selecting an item from the list, setting selectedindex = -1 doesn't clear it. I have seen comments about setting the selectedindex property = -1 two times in a row, but that doesn't help when the user enters text in the field. Any work arounds and/or an explanation of why this happens would be greatly appreciated.

Thanks,
Tom
 
Are you saying that setting the Text property to "" doesn't clear the text?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top