954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

User Adding Text To Combobox

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.

Alex_2011
Light Poster
34 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 
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
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: