|
-
October 23rd, 2001, 03:35 AM
#1
Combo Box Nightmare
I have a Combo Box which is part of a Control Array. I am trying to code the change event of the combo box but when I do actually re-select an item from the list the Change Event is not initiated, what am I doing wrong ?
Work is necessary for man. Man invented the alarm clock.
-
October 23rd, 2001, 03:57 AM
#2
Re: Combo Box Nightmare
Hi,
When you select an item from the combo, click event is fired. You need to handle that.
Regards,
Lalitha
-
October 23rd, 2001, 04:00 AM
#3
Re: Combo Box Nightmare
But you can click the combo box without actually changing the contents of the Text, Do I have to record the Text on the click and then use the lost focus to re-check the contents to see if its changed, if so why is the change event there ?
Work is necessary for man. Man invented the alarm clock.
-
October 23rd, 2001, 04:00 AM
#4
Re: Combo Box Nightmare
Hi...
Also wnated to add one more..A combo box is an editable list box. So the user can enter in the edit box. Change event will be fired when the user enters text in the combo.
Regards,
Lalitha
-
October 23rd, 2001, 04:19 AM
#5
Re: Combo Box Nightmare
The text selected in the combo at moment can be got from the text property.
To clearly understand when the change event occurs, open a new vb project, add a combo and a button to it and paste the code below....
Private Sub Combo1_Change()
MsgBox "Change"
End Sub
Private Sub Combo1_Click()
MsgBox "click"
End Sub
Private Sub Command1_Click()
MsgBox Me.Combo1.Text
End Sub
Private Sub Form_Load()
me.Combo1.AddItem "my"
me.Combo1.AddItem "combo"
me.Combo1.AddItem "test"
End Sub
Then type in the text box in combo....The message "Change" will be displayed. Select some item ...then click on the button....the text selected will be displayed.
The change event may be used to display the item starting with the typed characters as and when the user types. Eg. when the user starts typing "t" we can display test.
Hope thsi answers your question
Regards,
Lalitha
-
October 23rd, 2001, 08:01 AM
#6
Re: Combo Box Nightmare
The change event is used to record changes to the text box of a combobox.
To detect clicking a List Item of a combobox use the _Click event. Here is a small demo
option Explicit
private Sub Combo1_Change()
MsgBox "Change Event " & Combo1.Text
End Sub
private Sub Combo1_Click()
MsgBox "Click Event " & Combo1.List(Combo1.ListIndex)
End Sub
private Sub Form_Load()
Dim x
for x = 1 to 10
Combo1.AddItem x
next x
End Sub
\
John G
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|