Solved

VB6 Combo Box Clear

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Basic Java Case or If-Else statement... 3 57
Math Equation 23 105
Identify two keyboard codes and how to enter them 9 56
backup program with robocopy 6 45
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

860 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