Solved

How to handle Click Event of ComboBox in VB 6 ?

Posted on 2003-11-05
7
420 Views
Last Modified: 2013-12-26
I have got the following code written in Click event of ComboBox but never got executed when I'm clicking on the Combo Box

Private Sub cmbList1_Click()
msgbox "Entered Combo Click Event"
End Sub
0
Comment
Question by:nivaspramod
7 Comments
 
LVL 18

Expert Comment

by:Sethi
ID: 9686006
Use the change event:

Private Sub cmbList1_Change()
msgbox "Entered Combo Click Event"
End Sub
0
 
LVL 39

Expert Comment

by:appari
ID: 9686308
click event fires when you select an item from the list.
change event fires when text is changed by typing in the text area of the combobox.
0
 
LVL 1

Expert Comment

by:hazgod
ID: 9691865
i always use the change event. otherwise, if you scroll instead of using dropdown and selecting the option, the click event won't happen.
0
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.

 

Author Comment

by:nivaspramod
ID: 9706575
I got it working by using GotFocus and Validate events of the combobox. Actually the problem is to retain the value before i change the value in the combo box and once changed the value should be updated to the database. So, I tried Change and Click events of ComboBox to retain the value before changing the value.

 Let me know Is this the right way of doing it ?

 Storing  the old value once the Combo Box gets Focus and checking the value in the validate event whether current value is same as the old value or not.
0
 
LVL 18

Expert Comment

by:Sethi
ID: 9706653
Yes that the perfect way.
0
 
LVL 18

Accepted Solution

by:
Sethi earned 125 total points
ID: 9706654
Yes that's the perfect way.
0
 

Author Comment

by:nivaspramod
ID: 9721835
"Storing  the old value once the Combo Box gets Focus and checking the value in the validate event whether current value is same as the old value or not."

is the right answer.
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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

863 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

21 Experts available now in Live!

Get 1:1 Help Now