Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
Solved

# fix format number generator

Posted on 2012-04-12
Medium Priority
364 Views
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
``````
0
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
• 2

LVL 45

Expert Comment

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

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 45

Accepted Solution

AndyAinscow earned 2000 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

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
###### Suggested Courses
Course of the Month11 days, 8 hours left to enroll