Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:46:06+00:00 2026-05-29T17:46:06+00:00

I need an elegant way using VB.Net to iterate through a range of IP

  • 0

I need an elegant way using VB.Net to iterate through a range of IP addresses when the input will come to my app as a string in this format:

192.168.100.8-10

This range would include 3 addresses:

192.168.100.8, 192.168.100.9, 192.168.100.10.

I found a solution in C# that uses the IP Address class that I could probably convert to VB but it seemed to be way too much code for what I need to do. I could definitely use a bunch of string parsing functions but I was hoping someone already had a simple way of doing this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:46:06+00:00Added an answer on May 29, 2026 at 5:46 pm

    Here is a solution. It would be even easier using generic lists…

        Dim arrFinalIpList() As String
    
        Dim strIP As String = "192.168.100.8-10"
    
        Dim arrIP() As String = strIP.Split(".")
        Dim strPrefix As String = arrIP(0) & "." & arrIP(1) & "." & arrIP(2) & "."
        Dim arrMinAndMax() As String = arrIP(3).Split("-")
    
        Dim intCursor As Integer = 0
    
        For intCursor = CInt(arrMinAndMax(0)) To CInt(arrMinAndMax(1))
    
            If arrFinalIpList Is Nothing Then
    
                ReDim arrFinalIpList(0)
                arrFinalIpList(0) = strPrefix & intCursor.ToString()
    
            Else
    
                ReDim Preserve arrFinalIpList(arrFinalIpList.Count)
                arrFinalIpList(arrFinalIpList.Count - 1) = strPrefix & intCursor.ToString()
    
            End If
    
        Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need an elegant way to implement credit-based purchases for an online store with
I need to find 2 elegant complete implementations of public static DateTime AddBusinessDays(this DateTime
need ask you about some help. I have web app running in Net 2.0.
I need to find an elegant way to do 2 kinds of MixIns. First:
I am trying to come up with a way using ajax and jquery to
I can't figure out an elegant way to accomplish the following using CSS: I
I'm using Javascript along with Date.js and need to translate string representations of times.
I am using the DataAnnotations for error checking on my asp.net mvc app, I
This is an ASP.Net 2.0 web app. The Item template looks like this, for
Is there any more elegant way to do the following? Basically I need an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.