Solved

fix format number generator

Posted on 2012-04-12
3
355 Views
Last Modified: 2012-04-16
hello,
how can i prevent numbers between this range from being generated
"5550100" through "5550199"

                For x As Integer = 2000000 To 9999999
                    If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
                        objWriter.WriteLine(x.ToString("D7"))
                    End If
                Next

Open in new window

0
Comment
Question by:XK8ER
  • 2
3 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 37836320
For x As Integer = 2000000 To 9999999
if x < 550100 or x > 550199 then
                    If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
                        objWriter.WriteLine(x.ToString("D7"))
                    End If
end if
                Next
                                 

1:
0
 
LVL 8

Expert Comment

by:PagodNaUtak
ID: 37836820
For x As Integer = 2000000 To 9999999
       If x > 550100 AndAlso x < 550199 then
               Continue For
       End If
       If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
               objWriter.WriteLine(x.ToString("D7"))
       End If
Next
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 37838620
I've thought of something simpler than my first comment:

For x As Integer = 2000000 To 9999999
if x = 550100 then x = 550200
                    If x.ToString Like "[2-9]*" And Not (x.ToString("D7") Like "[1-9]11*") Then
                        objWriter.WriteLine(x.ToString("D7"))
                    End If
                Next
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question