Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar.ToString() = Chr(13) Then
Dim str As String = TextBox1.Text
If Not ListBox1.Items.Contains(str) Then
ListBox1.Items.Add(str)
End If
End If
End Sub
Private Sub btn_Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex > 0 Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End Sub
Private Sub btn_Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ListBox1.Items.Clear()
End Sub
通过JS或JQUERY来实现