Solved

VB6 Combo Box Clear

Posted on 2004-04-20
5
1,710 Views
Last Modified: 2012-06-21
I have in a Visual Basic 6 program a Combo box full of data and I want the user to be able to select through the drop down menu and get a choice. I  have about 5 of these. I am wanting to have a RESET button at the bottom where it will set all of the combo boxes back to blank but still keep the values in the list.

Please help.

0
Comment
Question by:Ckesey
  • 3
5 Comments
 
LVL 2

Accepted Solution

by:
taherzm earned 250 total points
ID: 10870194
do u load data into the combo box at runtime?
if so then add a blank item at the begginning

cbo1.additem ""

cbo2.additem ""


otherwise at design time just add a blankitem at the top...

onclick of the reset button...

cbo1.listindex=0

cbo2.listindex=0

hope this helps....
0
 
LVL 2

Expert Comment

by:taherzm
ID: 10870248
also on loading the form if u want to select the first value then just write this in the form_load event

cbo1.listindex=1
cbo2.listindex=2

ps: pls replace cbo1,cbo2 with the respective names that u r using
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 10870594
Just set the Text value of the ComboBox to "".

Private Sub Command1_Click()
    For i = 0 To Combo1.UBound
        Combo1(i).Text = ""
    Next i
    ' If they are not part of a control array then you have to do each one individually
End Sub

Idle_Mind
0
 

Author Comment

by:Ckesey
ID: 10871098
Thanks. That worked.

0
 
LVL 2

Expert Comment

by:taherzm
ID: 10871124
glad to have helped...:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now