I am using software that scripts with VB .NET and I am trying to have a textbox hidden unless a combo box above it has "other" selected. So the user will select something from the combo box and if it is "other" then I want a certain textbox to become visible to type information into. If they pick something other than "other" then I want the textbox to remain hidden. Thanks!

Hide/Show Certain Text Fields in a form
B_Lilith
Herbert Lehner
Well when the selectedindex has been changed, you can then check to see the value of the item chosen, and if it matches your condition then make the textbox visible:
if me.theComboBox.SelectedItem.ToString().Equals("other") then
me.theTextBox.Visible = true
else
me.theTextBox.Visible = false
end if
On the combo box, you may implement the SelectedIndexChange event and when you change the value item chosen from the combo box, this event gets fired and from here, you can then make the textbox appear/disappear depending on the condition of your choice.
hope it helps!
seco
chris441962
Well, you would put the code on the selectedindexchanged event.
so, in your Design View, click on the combobox, then in the properties, select the events button (the one that looks like a lightning symbol)
somewhere in there, there will be a property called something like "selectedindexchanged" - just doubleclick on it to make an event.
once done, you should be automatically be taken into the code and the event should have been created.
here is where you enter that code.
TommieJ
this is because of the code. if the text selected from the combo box is NOT "other" then it will hide the textbox, otherwise if the text "other" is selected in the combo box, the textbox will appear.
the code given was an example, you will have to modify it to your needs
gooon
Noral
change SelectedText to SelectedItem.ToString() then....
on the form, select the textbox and make the visible property to false. this will not show the textbox at all.
in your code, the textbox will become visible when you select an item from the combobox on the selectedindexchange event.
example:
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If Me.ComboBox1.SelectedItem.ToString().Equals("other") Then Me.TextBox1.Visible = True Me.TextBox1.Text = "hi" Else Me.TextBox1.Visible = False End If End Sub