Fellow earthlings, my planet needs your help!
I have absolutely no idea why this wouldn't work? I thought it was working last night but apparently not?
What I'm trying to do is prevent an item from being added to the Listbox1 list twice...
So if the item is within the log, dont add it to listbox1. If it's not in the log or in listbox1 then add it.
If its not in logcmb but already in listbox1 then don't add it.
The logcmb is saved and loaded at form load and unload.
Code: Code:
If LogCmb.Items.Contains(tmp) Then
'don't add it
Else
If ListBox1.Items.Contains(tmp) Then
'This is already in the list
Else
If InStr(tmp, "http") Then
'if the string contains http then don't add it
Else
ListBox1.Items.Add(LCase(tmp))
statusbarlbl.Text = ListBox1.Items.Count & " available"
End If
End If
End If
:afrog:
Re: Fellow earthlings, my planet needs your help!
Try something like this:
Code:
If tmp.IndexOf("http") = 0 AndAlso LogCmb.Items.Contains(tmp.ToLower) = False Then
ListBox1.Items.Add(tmp.ToLower)
statusbarlbl.Text = ListBox1.Items.Count & " available"
End If
And don't make a new thread asking the same question
Re: Fellow earthlings, my planet needs your help!
I think maybe the problem is that you are changing the item to all lower case when you add it. So when the item is checked against existing items if it has upper case letters then it won't match.
Re: Fellow earthlings, my planet needs your help!
Quote:
Originally Posted by JuggaloBrotha
Try something like this:
Code:
If tmp.IndexOf("http") = 0 AndAlso LogCmb.Items.Contains(tmp.ToLower) = False Then
ListBox1.Items.Add(tmp.ToLower)
statusbarlbl.Text = ListBox1.Items.Count & " available"
End If
And don't make a new thread asking the same question
Thanks boss.