Hello, I'm using Visual Basic 2010 to create an invoice and need help displaying the textbox1 input to the listbox. Any suggestions?
ListBox1.Items.Add(TextBox1.Text) This is the code I tested and it worked! You may, however, want to add an If statement to this or perhaps a try-catch, otherwise your application may hit an error if the textbox is left empty!
Private Function AddText() Listbox1.Items.Add(Textbox1.text) End Function Private Sub Button1_Click(whatever goes in here) Handles Button1.Click AddText() End Sub
Why bother to call an external function? That wastes cycles...
meh. just in case he needs to do it again, he doesn't have to type it all out again, and he can just use the function.
Good point!
oops. It should be Private Sub.
Join our real-time social learning platform and learn together with your friends!