By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,725 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,725 IT Pros & Developers. It's quick & easy.

Combobox Change event

P: 284
I am using vb6.

I want to solve one problem to define clearly i will use a simple example.

Take a form and put a combobox in it

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Combo1.AddItem "Apple"
  3. Combo1.AddItem "Banana"
  4. Combo1.AddItem "orange"
  5. Combo1.AddItem "Lemon"
  6. End Sub
and on change event

Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo1_Change()
  2. MsgBox Combo1.Text
  3. End Sub
Now select differenct name like banana and orange with mouse or arrow keys but you will not get any message,why change event is not accuring when we change name and on what event we will get message as we select different name.

i want that when i change the name it will prompt/message me the selected name.
Jan 14 '09 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,127
You need to use the Click event of the control.
Jan 14 '09 #2

Expert 100+
P: 1,445

Change Event is Fired only when Style=0 or 1 and text in the text box portion of the control changes.
So, as Debasis told, you need to write the code in Click event.

Jan 15 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.