|
-
Aug 10th, 2005, 10:03 PM
#1
Thread Starter
Frenzied Member
Looping through listboxes[Resolved]
Basicly I am taking one item from one listbox and matching it with all the other items in the second listbox. Here is what it looks like:
VB Code:
Dim Check As Boolean
For X = 0 To List1.ListCount - 1
Check = PortCheck(List2.List(0), List1.List(X))
If Check = False Then
Status.Caption = "Moving on..."
End If
Next X
Now, that will go through the portcheck with each item in the second listbox. Now here is what I am having trouble figuring out how to do. Once the second listbox has ran out of items to check with, I want the first item in the first listbox to move down one, then repeat the same loop as shown above. So basicly I just need to put the above loop in a bigger loop, but I really can't figure out how >_< Any help would be nice
Last edited by Inuyasha1782; Aug 10th, 2005 at 11:14 PM.
Age - 15 ::: Level - Advanced
If you find my post useful please ::Rate It::

-
Aug 10th, 2005, 10:10 PM
#2
Re: Looping through listboxes
VB Code:
Dim Check As Boolean
For X = 0 To List1.ListCount - 1
For i = 0 to list2.listcount - 1
Check = PortCheck(List2.List(i), List1.List(X))
If Check = False Then
Status.Caption = "Moving on..."
End If
Next i
Next X
I think thats right
-
Aug 10th, 2005, 10:11 PM
#3
Re: Looping through listboxes
Put a 'nested, For Next structure using the ListCount of the 'other' ListBox.
VB Code:
For x = 0 to List1.ListCount -1
For y = 0 to List2.ListCount -1
'Bla
next y
next x
-
Aug 10th, 2005, 10:13 PM
#4
Re: Looping through listboxes
What are you comparing? You want to find item A in list B for each item in A?
The, if you find it, what do you want to do?
-
Aug 10th, 2005, 10:16 PM
#5
Thread Starter
Frenzied Member
Re: Looping through listboxes
I'll try those other to thanks.
dglienna, I am comparing an Ip with ports, when the Ip and port match, I log it, basicly just a simple port scanner except for multiple Ip's. So yes, I take one Ip scan it with each port, and now when im done with that, I want to move onto the next Ip, I think that's what you said.
*Edit* Erm, I dont think those other 2 are quite what I wanted. Don't those just match each item in each listbox with each other?
Age - 15 ::: Level - Advanced
If you find my post useful please ::Rate It::

-
Aug 10th, 2005, 10:39 PM
#6
Thread Starter
Frenzied Member
Re: Looping through listboxes
Okay, that's doing it backwards ^^ I want it the other way around, that's just doing one Ip with one port, then the second Ip with the same first port. I want it the First Ip with the first port, then the first Ip with the second port, etc etc.
Age - 15 ::: Level - Advanced
If you find my post useful please ::Rate It::

-
Aug 10th, 2005, 10:44 PM
#7
Re: Looping through listboxes
Maybe?
VB Code:
Dim Check As Boolean
For i = 0 to list2.listcount - 1
For X = 0 To List1.ListCount - 1
Check = PortCheck(List2.List(i), List1.List(X))
If Check = False Then
Status.Caption = "Moving on..."
End If
Next X
Next i
-
Aug 10th, 2005, 10:59 PM
#8
Thread Starter
Frenzied Member
Re: Looping through listboxes
Alright that works One last thing, how would I show the selected Port and Ip it's on? Like the current one it's one, I want to be selected in the list.
Age - 15 ::: Level - Advanced
If you find my post useful please ::Rate It::

-
Aug 10th, 2005, 11:01 PM
#9
Re: Looping through listboxes
VB Code:
Dim Check As Boolean
For i = 0 to list2.listcount - 1
For X = 0 To List1.ListCount - 1
msgbox list2.list(i) & list1.list(x)
Check = PortCheck(List2.List(i), List1.List(X))
If Check = False Then
Status.Caption = "Moving on..."
End If
Next X
Next i
BTW, you should learn how to format your code for easier reading
-
Aug 10th, 2005, 11:05 PM
#10
Thread Starter
Frenzied Member
Re: Looping through listboxes
I know, I have been working on it, I usually only tend to really do it when I submit all my code, but im working on it ^^
Also, I ment you know how you can highlight things in a listbox. I want the current Ip and Pass it's on to be highlighted in the listbox.
Age - 15 ::: Level - Advanced
If you find my post useful please ::Rate It::

-
Aug 10th, 2005, 11:10 PM
#11
Re: Looping through listboxes
VB Code:
Dim Check As Boolean
For i = 0 to list2.listcount - 1
List1.Selected(i) = True
For X = 0 To List1.ListCount - 1
List2.Selected(x) = True
Check = PortCheck(List2.List(i), List1.List(X))
If Check = False Then
Status.Caption = "Moving on..."
End If
Next X
Next i
That should do it
-
Aug 10th, 2005, 11:13 PM
#12
Thread Starter
Frenzied Member
Re: Looping through listboxes
Thanks for all the help *I would rate, but you help me to much *
Age - 15 ::: Level - Advanced
If you find my post useful please ::Rate It::

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
|