How to handle Click Event of ComboBox in VB 6 ?

Posted on 2003-11-05
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
Question by:nivaspramod
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 9686006
Use the change event:

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

Expert Comment

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.

Expert Comment

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.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

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.
LVL 18

Expert Comment

ID: 9706653
Yes that the perfect way.
LVL 18

Accepted Solution

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

Author Comment

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.

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 46
Add a task in Outlook from access 11 43
Passing a Text Box name to a Sub 6 104
Formula problem with Excel attachment 6 44
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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 …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

737 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