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
3
Medium Priority
?
364 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 45

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 45

Accepted Solution

by:
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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

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…

636 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