Results 1 to 3 of 3

Thread: [RESOLVED] Data filtering

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Resolved [RESOLVED] Data filtering

    Hi Everyone,

    I have a program that is reading a list of IP address from a text file. I would like to sort all files that begin with “192.168.X.X” and display them in a listbox. All other IPs can be disregarded.

    For example,
    Below is data in my text file:
    192.168.1.1
    15.265.56.894
    64.233.167.99
    64.191.203.30
    192.168.2.569

    Once the program runs, the data in the listbox should look like below:
    192.168.1.1
    192.168.2.569

    How exactly would I code the logic to only look for "192.168." then kick the entire string to a listbox?
    Last edited by Giraffe Frenzy; May 19th, 2007 at 06:26 AM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Data filtering

    vb Code:
    1. If myString.StartsWith("192.168.") Then
    2.     myListBox.Items.Add(myString)
    3. End If
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2006
    Posts
    250

    Re: Data filtering

    That worked great. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width