So basically i have 2 forms, when the listbox on form one wants to add to the listbox on form 2 i want to see if the item being added is already in listbox on form 2. I am not using searchlite as i don't understand it so this is what i have.
LINE 4 IS THE LINE THAT IM TRYING TO IMPLEMENT.
Private Sub btnAddYourList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddYourList.Click
If lstTitle.Text = "" Then
MsgBox("Sorry, you have not selected anything.", vbOKOnly + vbCritical, "Nothing???")
ElseIf lstTitle.SelectedItem(frmYourList.lstYourList.Items) Then
MsgBox("Already In Your List", vbOKOnly, "Already Added")
Else
frmYourList.lstYourList.Items.Add(lstTitle.Text)
lblCopied.Text = "Selected Item Copied"
frmYourList.lblItemCount.Text = frmYourList.lstYourList.Items.Count & " Items In List"
lblMainYourItems.Text = frmYourList.lstYourList.Items.Count & " Items In Your List"
End If
End Sub
hope you can understand what im doing. Thanks Will check back soon
PS, i know that i can send selected listbox value to textbox and check that way but didn't want to code it that way.
you wouldnot believe it, while writing the main post i re read it after i sent it and worked it out.
the code was around the wrong way. IE:
ElseIf frmYourList.lstYourList.Items.Contains(lstTitle.Text) Then
MsgBox("Already In Your List", vbOKOnly, "Already Added")
Thanks anyways

New Topic/Question
Reply




MultiQuote




|