Dear All,

I have the following code but I need to make the users add text to my (Combobox) drop down list.

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim userMsg As String
        userMsg = Microsoft.VisualBasic.InputBox("Enter New City", "New City", "", 500, 500)
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
       
    End Sub
End Class

Each time I enter the text in the box after clicking the (Add button), it does not add it in the combobox. What's missing??

Thank you.

Each time I enter the text in the box after clicking the (Add button), it does not add it in the combobox. What's missing??

You code never add text to combo box.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim userMsg As String
        userMsg = Microsoft.VisualBasic.InputBox("Enter New City", "New City", "", 500, 500)
        ComboBox1.Items.Add(userMsg)
    End Sub
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.