Hi,
I have created a comboBox and want to set it so when a user selects option1 from the drop down list. a Text box populates with text for the user to see.
Is this possible?
Thanks
Printable View
Hi,
I have created a comboBox and want to set it so when a user selects option1 from the drop down list. a Text box populates with text for the user to see.
Is this possible?
Thanks
Each item in the combobox is assigned an index starting at 0. From there, you can test which item is selected with a conditional logic statement (If...Then...). If the item selected is at your index (0), then call the TextBox's Text property and assign it the SelectedItem.
Since the items in a ComboBox are object, you to to convert them .ToString.
Make sure you're doing all of this in the default event, which can be created by double-clicking on the ComboBox in the designer.
Why not just do the following:
HTML Code:Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox1.Text = ComboBox1.Text
End Sub
1. That gives him an answer instead of allowing him to to figure it out on his own.
2. He may need to know if a specific item is selected. What if he wants the text to appear in the box if the first item is elected, but additional options appear on the second? And so on.
3. And the OP asked how he could accomplish his task when the first item was selected, not any.
Are you scolding me?