Valhalla Legends Forums Archive | Visual Basic Programming | Combo1.change help.

AuthorMessageTime
GoSu_KaOs
I don't know why this isn't workin.

[code]Private Sub Form_Load()
Combo1.AddItem "test"
End Sub

Private Sub Combo1_Change()
txtTest.text = Combo1.text
End Sub[/code]

When I select "test" from the combobox, it doesent put anything in txtTest.text. Only when I type something in the combobox, it puts everything from the combobox to txtTest.text.

I need to make it so when you select something from the dropdown menu in the combobox ( without typing), it shows the selected item in txtTest.text.
December 1, 2004, 1:47 AM
LivedKrad
The Combo box's "change" event is only fired when the textbox portion of the box is changed, not within the box itself. As a matter of fact, when you select a new item and the item in the textbox is changed, it still isn't fired.
December 1, 2004, 3:52 PM
GoSu_KaOs
Is there a way to activate the change event when clicking on an item?
December 1, 2004, 4:17 PM
UserLoser.
[quote author=GoSu_KaOs link=topic=9732.msg90701#msg90701 date=1101917827]
Is there a way to activate the change event when clicking on an item?
[/quote]

Call the sub "Combo1_Change"
December 1, 2004, 7:47 PM
Myndfyr
Wow guys.  Both of you flame me for flaming people, and yet both LivedKrad and UL are utterly unwilling to help this guy when it is blatantly obvious what he's asking for help with.  And one of you called me a hypocrite.  Hrm.

GoSu_KaOs: You're using the wrong event.  According to the Click event page in MSDN, in Visual Basic 6, the Click event is fired for a Combo Box control when the user selects an item, either by using the mouse or the arrow keys.
December 2, 2004, 2:22 AM
UserLoser.
[quote author=MyndFyre link=topic=9732.msg90757#msg90757 date=1101954175]
Wow guys.  Both of you flame me for flaming people, and yet both LivedKrad and UL are utterly unwilling to help this guy when it is blatantly obvious what he's asking for help with.  And one of you called me a hypocrite.  Hrm.
[/quote]

This is yet another MyndFyre flame?  I'm sorry, I didn't flame you.  Correct me if I'm wrong one-who-knows-everything, but calling that sub is the equivalent of whatever else calling it when the combobox changes.

[quote author=GoSu_KaOs link=topic=9732.msg90701#msg90701 date=1101917827]
Is there a way to activate the change event when clicking on an item?
[/quote]

Read that, he asked if there's a way to activate the change event.  ComboBox1_Change() is the change event.  Calling it calls the change event.  No where does it say what items he's talking about either.  Items in that combobox, items in a listbox, items in a collection, array, etc. Sorry, I'm a smartass like that.

[code]
Call ComboBox1_Change 'This calls the change event
[/code]

It's ok, MyndFyre does this all the time, so why can't I do it:

MyndFyre: All you do is flame people, post with this stupid attitude like you're better than everyone else, talk about your bot (which I'm yet to see someone use), or occasionally answer someone's question.  You're 20 (if your profile is even true), grow up
December 2, 2004, 2:33 AM
Myndfyr
UL, You know damn well what the problem was that this guy was having.  Calling the sub wouldn't have fixed his problem, because by his two questions it was obvious that the functionality he wanted was to have his text box update when a different item in his combo box was selected.  You're correct, calling that sub IS the equivalent of the runtime calling it when the combobox changes, but someone who is 17 (if your profile is accurate) ought to have been able to understand his intent from the first post and respond appropriately.

UserLoser.: I do not flame people all the time, and if anybody has an attitude, it is certainly both you and LivedKrad.  I hardly ever talk about my bot, unless I'm referring to a design issue, and I could really care less whether or not someone uses it, nor do I think it's pertinent.
December 2, 2004, 2:45 AM
GoSu_KaOs
Aight, the Combo1_Click() worked. Thx a lot.
December 3, 2004, 1:51 AM

Search