Solved

How to handle Click Event of ComboBox in VB 6 ?

Posted on 2003-11-05
7
426 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
[X]
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
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
Technology Partners: 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

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

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!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

729 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