How can i display the selected item's text in the dropdownlist?
Assumed i have a dropdownlist with 3 items which are:
"one"
"two"
"three"
When i selected "three" then the word "three" will appear in the textbox.

Recommended Answers

All 4 Replies

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("One")
        ComboBox1.Items.Add("two")
        ComboBox1.Items.Add("Three")
           End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        TextBox1.Text = ComboBox1.SelectedItem
    End Sub

Do i need to add any attributes to the ComboBox1?
It is nt working for me....

I think you should use:

TextBox1.Text = ComboBox1.SelectedValue

or something like that.

No there is no attribute that need to be set..This code is in VB.Net.Do You want the code in VB.net or any other language.Its not possible that above code is not working in VS 2005.

Be a part of the DaniWeb community

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