Solved

fix format number generator

Posted on 2012-04-12
3
358 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

732 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