I need to to this: If the selected option / item is "Enabled" I want to preview a textbox.

I've tried this:

        If ComboBox6.SelectedItem = "Enabled" Then
            TextBox10.Visible = True
        Else
            TextBox10.Visible = False
        End If

And also this:

        If ComboBox6.Text = "Enabled" Then
            TextBox10.Visible = True
        Else
            TextBox10.Visible = False
        End If

Thanks in advance,
Isaac

PS: I'm using DropDownList

Recommended Answers

Is the code in the ComboBox6_SelectedIndexChanged event handler? If so it should work. It works just fine for me (vb 2010). Iincidentally you can shorten the code to

TextBox10.Visible = (ComboBox6.Text = "Enabled")

You don't need the parentheses but if you leave them out it looks …

Jump to Post

All 3 Replies

Is the code in the ComboBox6_SelectedIndexChanged event handler? If so it should work. It works just fine for me (vb 2010). Iincidentally you can shorten the code to

TextBox10.Visible = (ComboBox6.Text = "Enabled")

You don't need the parentheses but if you leave them out it looks like a multiple assignment.

sorry n00b mistake
I forgot to enter an event handler
thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.