Solved

VB6 Combo Box Clear

Posted on 2004-04-20
5
1,708 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
add text to end of existing text in file 16 61
sumHeights2  challenge 7 75
factorial example challenge 10 61
array6 challenfge 6 62
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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…

707 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

17 Experts available now in Live!

Get 1:1 Help Now