Solved

fix format number generator

Posted on 2012-04-12
3
342 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now