validating listbox

sgfreestyler

Member
Joined
Aug 6, 2005
Messages
6
Programming Experience
1-3
i'm trying to add text from the textbox to the listbox. but i do not want to add if the text that is in the textbox has already being add in the listbox.

how do i do that

=============
If Not TextBox4.Text = xxxxxxxxxxxxxxx Then
FormTwo.ListBox1.Items.Add(tx.Text)
Else
MsgBox("item has added before")
End If
=============

wat shd be the code for the xxxxxxxxxx
 
Very simple
You can code this in the add event

If
ListBox1.Items.Contains(TextBox1.Text) Then
MsgBox("Item has been adeed before")

TextBox1.Text = ""

Else

ListBox1.Items.Add(TextBox1.Text)

TextBox1.Text = ""

End If

 
Back
Top