Sup guys, Im still very new to VB..and Im taking a programming Visual Basic class right now. Our instructor said late this week we're gonna be workin with combo boxes and option buttons..so I wanna get a head start and learn it.
Im foolin around right now..with the combo boxes..trying to get things added to them. I did a search..and found that only items can be added in the Form_Load section...why is that?
When I go into the code for the combo box thingie..and put like
cmb1.additem "hello" it wont list it at runtime...but when I put it in Form Load...it will ....????
Also...can someone tell me how to or whats the code for like option buttons? how do they work?
Also...if i want to select like "hello" from my combo box and have it appear in my text box...how do i do that? Thanx!!
You need to load the combo box at runtime, and generally the best place to do it from is the Form_Load event...
To get the text from the combo try this:
VB Code:
Text1.Text = Combo1.List(Combo1.ListIndex)
That will put the selected text of the combo into the text box. This is assuming that the style of the combo box is 2 - Dropdown, and that an item is selected in the combo (if not item is selected, then the ListIndex value will be -1, and the line above will crash...