Solved

How to handle Click Event of ComboBox in VB 6 ?

Posted on 2003-11-05
7
419 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
Comment Utility
Use the change event:

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

Expert Comment

by:appari
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:nivaspramod
Comment Utility
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
Comment Utility
Yes that the perfect way.
0
 
LVL 18

Accepted Solution

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

Author Comment

by:nivaspramod
Comment Utility
"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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

744 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

16 Experts available now in Live!

Get 1:1 Help Now