Following example describe to add textbox value to a list box by clicking a button in vb.net
This example requires windows form that contains Listbox, Textbox and one button control.
- Private Sub Button1_Click(ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles Button1.Click
- If TextBox1.Text.Trim() <> "" Then
- ListBox1.Items.Add(TextBox1.Text.Trim())
- End If
- End Sub