cleaning a LisIndex -1

Hi, I have a form in Visual Basics. when this form loads it fills a combobox and this info comes from an Access databases. Also when you click this combobox it displays the description of the selection in another textbox.
and then when i save a record i want the form to clean up all textboxes and comboboxes.  so i tried to write after the save statement "cbobox.listindex = -1" but it doesn't work.  because it goes back to the click statement. do you know what i can do..
hopefully i made myself clear. please let me know if you need a better explanation. Thanks a lot.
mapyAsked:
Who is Participating?
 
aelatikConnect With a Mentor Commented:
'Make a boolean var like CLEANING

Dim CLEANING As Boolean

' In your click event check for that var before activating

Private Sub cbobox_Click()
    If CLEANING = False Then
        ' Exucute your code
    End If
End Sub

' When your clearing the listindex set CLEANING to true and the click event won't execute
' When done just set the CLEANING var to false and the click event will work again.
0
 
srimanthCommented:
try:

cbobox.clear         'Clears the ComboBox
textbox.text = ""   'Clears the textbox

cheers,
srimanth.
0
 
aelatikCommented:
Now im confused, do you mean clearing the controls or setting it to its begin value ( deselecting everything )
0
 
mapyAuthor Commented:
yes, after saving a record i want to set it up to its begin value.
thank you all, but aelatik is right.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.