|
-
Mar 4th, 2008, 01:59 PM
#1
Thread Starter
Hyperactive Member
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
-
Mar 4th, 2008, 02:16 PM
#2
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
-
Mar 4th, 2008, 02:18 PM
#3
Member
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.
-
Mar 4th, 2008, 03:34 PM
#4
Thread Starter
Hyperactive Member
Re: Fellow earthlings, my planet needs your help!
 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.
8 gigs/ram (hey why not)
300 gig HD x2
Windows XP 64
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|