Jan 2nd, 2007, 10:00 PM
#1
Thread Starter
Hyperactive Member
Organizing Ip Ranges
I'm trying to organize ip ranges into their own type. For example, if i load this text document into a listbox:
209.170.113.9
213.161.66.236
209.170.113.31
209.170.113.7
60.254.129.78
209.170.113.24
209.170.113.17
206.16.213.8
206.16.213.14
66.77.68.17
206.16.213.8
Then I'd like my program to put everything next to its own ip range, like:
209.170.113.9
209.170.113.31
209.170.113.7
209.170.113.24
209.170.113.17
206.16.213.8
206.16.213.14
213.161.66.236
60.254.129.78
66.77.68.17
Arranging everything into its own sequence, and leaving the "non-sequenced" ones at the bottom. I'm not sure how to do this, so codes and an exampe would really be appreciated. Thanks for any help.
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 10:06 PM
#2
Re: Organizing Ip Ranges
Try setting (at build) the ListBox Sorted = True.
Will yeild (however, different from your sort):
206.16.213.14
206.16.213.8
206.16.213.8
209.170.113.17
209.170.113.24
209.170.113.31
209.170.113.7
209.170.113.9
213.161.66.236
60.254.129.78
66.77.68.17
Last edited by Bruce Fox; Jan 2nd, 2007 at 10:22 PM .
Jan 2nd, 2007, 10:39 PM
#3
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
That sort is fine. But i don't understand wha you're trying to say. Could you write me an example?
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 10:55 PM
#4
Re: Organizing Ip Ranges
There's no "writing of code" involved... you just set the sorted property of the listbox at design time in the IDE.
Jan 2nd, 2007, 11:00 PM
#5
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
Oh really. Mind showing me the exact option of this?
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:03 PM
#6
Re: Organizing Ip Ranges
Within VB, select the ListBox in question from the dropdown list in the 'Proporties Window'.
Scroll down til you see 'Sorted', then set that to True.
This is a property that can't be set at Run Time, hence having to set it a build.
Jan 2nd, 2007, 11:06 PM
#7
Re: Organizing Ip Ranges
Attached Images
Jan 2nd, 2007, 11:09 PM
#8
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
Okay, Done. Now, i need it to remove all instances in an ip range except 1. So if i loaded this into a listbox:
209.170.113.9
213.161.66.236
209.170.113.31
209.170.113.7
60.254.129.78
209.170.113.24
209.170.113.17
206.16.213.8
206.16.213.14
66.77.68.17
206.16.213.8
The Output listbox would look like this:
213.161.66.236
60.254.129.78
209.170.113.17
206.16.213.8
66.77.68.17
With only one instance of each IP range. (can be any instance)
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:13 PM
#9
Re: Organizing Ip Ranges
When you loading the File, only add ones that are unique (atleast the seond part) to the Sorted ListBox.
Now its up to you to have a go. When you get stuck post back
Jan 2nd, 2007, 11:16 PM
#10
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
That made no sense at all. I'm just taking my sorted list box and deleting all duplicates that are in the same ip range and only keep one, and putting the output in another listbox.
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:17 PM
#11
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
Only add ones that are unique?
^^ thats what my program is supposed to be doing, not me.[QUOTE]
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:18 PM
#12
Re: Organizing Ip Ranges
Ok then, iterate the first ListBox, and only transfer unique the ones.....
(Hint: Compare the one your about to transfer against the previous one loaded in the second ListBox)
Jan 2nd, 2007, 11:19 PM
#13
Re: Organizing Ip Ranges
Originally Posted by
k0zz
^^ thats what my program is supposed to be doing, not me.
Wow, thats amazing............. arn't YOU the programmer?
Jan 2nd, 2007, 11:19 PM
#14
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
You don't get it. Forget about sorting. I want to load text into a listbox and delete duplicate ip ranges, and only keep one ip from each range. Period. Add the one ip from each range to a new listbox. Nothing else. I'd like to know how to do this.
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:21 PM
#15
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
Originally Posted by
Bruce Fox
Wow, thats amazing............. arn't YOU the programmer?
Fricking bs post. The program is the programmers work, smart one.
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:23 PM
#16
Re: Organizing Ip Ranges
Yeh, and your the one writting the code to prevent/remove dups...
Oh, BTW, I would calm down a bit if you want assistance
Jan 2nd, 2007, 11:29 PM
#17
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
Enough bs posts from you. If you don't want to help, then don't post in the forum.
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:32 PM
#18
Re: Organizing Ip Ranges
Nice attitude, considering its YOU who needs free HELP, and most people won't waste their free TIME to help arses.
There are rules for determining the client IP ranges based on IP class, so in order to get just on client IP for a network address you need to parse based on that consideration first.
YOU figure that one out yourself. My last post in your thread. Cheers.
Jan 2nd, 2007, 11:35 PM
#19
Thread Starter
Hyperactive Member
Re: Organizing Ip Ranges
How many bs posters are there? Later little kiddos 8-|
"Remember, remember the 5th of November, the gun powder treason and plot. I know of no reason why the gun powder treason should ever be forgot."
Jan 2nd, 2007, 11:37 PM
#20
Re: Organizing Ip Ranges
I'm sorry I wasted your time
VB Code:
'Assumes that List one is Loaded and Sorted
Private Sub cmdTransfer_Click()
Dim intCount As Integer
Dim intIdx As Integer
intCount = List1.ListCount - 1
For intIdx = 0 To intCount
If List2.ListCount <> 0 Then
If Split(List1.List(intIdx), ".")(1) <> Split(List2.List(List2.ListCount - 1), ".")(1) Then
List2.AddItem List1.List(intIdx)
End If
Else
'First Item
List2.AddItem List1.List(intIdx)
End If
Next
End Sub
Yeilds:
206.16.213.14
209.170.113.17
213.161.66.236
60.254.129.78
66.77.68.17
Jan 2nd, 2007, 11:40 PM
#21
Re: Organizing Ip Ranges
Originally Posted by
leinad31
Nice attitude, considering its YOU who needs free HELP, and most people won't waste their free TIME to help arses.
There are rules for determining the client IP ranges based on IP class, so in order to get just on client IP for a network address you need to parse based on that consideration first.
YOU figure that one out yourself. My last post in your thread. Cheers.
Agreed leinad31!
k0zz - everyone know knows how ungratefull you are
Jan 2nd, 2007, 11:46 PM
#22
Hyperactive Member
Re: Organizing Ip Ranges
Originally Posted by
Bruce Fox
I'm sorry I wasted your time
VB Code:
'Assumes that List one is Loaded and Sorted
Private Sub cmdTransfer_Click()
Dim intCount As Integer
Dim intIdx As Integer
intCount = List1.ListCount - 1
For intIdx = 0 To intCount
If List2.ListCount <> 0 Then
If Split(List1.List(intIdx), ".")(1) <> Split(List2.List(List2.ListCount - 1), ".")(1) Then
List2.AddItem List1.List(intIdx)
End If
Else
'First Item
List2.AddItem List1.List(intIdx)
End If
Next
End Sub
Yeilds:
206.16.213.14
209.170.113.17
213.161.66.236
60.254.129.78
66.77.68.17
I wouldn't have bothered after his previous posts, but nice code nonetheless =)
Jan 2nd, 2007, 11:54 PM
#23
Re: Organizing Ip Ranges
Originally Posted by
Rob123
I wouldn't have bothered after his previous posts, but nice code nonetheless =)
Thanks Rob123.
Last edited by Bruce Fox; Jan 3rd, 2007 at 12:16 AM .
Jan 2nd, 2007, 11:58 PM
#24
Re: Organizing Ip Ranges
Just showing alternative methods for doing the same to keep thread somewhat in topic or something weird.
VB Code:
Private Sub cmdTransfer_Click()
Dim lngA As Long, bytTable(255) As Boolean, bytCurrent As Byte
For lngA = 0 To List1.ListCount - 1
bytCurrent = CByte(Split(List1.List(lngA), ".")(0))
If Not bytTable(bytCurrent) Then
bytTable(bytCurrent) = True
List2.AddItem List1.List(lngA)
End If
Next
End Sub
It is the 115th birthday of J.R.R. Tolkien btw.
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