Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > ASP.Net > accepting imput and limiting characters

Thread Tools Display Modes
Old 09-10-2008, 02:42 PM
cossiah cossiah is offline
Join Date: Sep 2008
Posts: 1
Unhappy accepting imput and limiting characters

alright, my 2nd day of work at my University library, and they want me to write a program in Visual Web Developer 2008 that can

1. accept a number between 1 and 99,999,999
2. accept a string between 1 and 99,999,999

and return a value: ncgre000|00000001|00000001

the second section of the returned value changes depending on what number is input, 1-1000 = 1, 1001-2000 = 2 and so on

the 3rd section is what ever number was input

the only problem is I'm only mildly familure with VB. I'm pretty proficient in C++ but i don't see how thats gonna help here

i have no idea where to start or what to even do to accept user input in VB, much less limit the number of characters and return it. well i have an idea for returning it (storing it in a variable) but im pretty lost otherwise

any suggestions?

I have my text box, and i have the number of characters limited, but im still trying to figure out how to limit its input to only numbers

Edit:wow i spelled input wrong, epic fail

Last edited by cossiah; 09-10-2008 at 03:04 PM.
Reply With Quote
Old 09-10-2008, 03:19 PM
wayneph's Avatar
wayneph wayneph is offline
Web Junkie

Retired Moderator
* Expert *
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393

Since it sounds like you're using ASP.NET (Visual Web Developer), I'd recommend using a RangeValidator control. It natively supports checking for a number between two values. (with virtually no code)

For the String you could use a RegularExpressionValidator and just use an expression that limits the user to a certain number of digits and make them optional.

RangeValidator Class
RegularExpressionValidator Class

The best part is that you can use Client Side and Server Side validation to get the best combination of security and performance.

(There are some How Tos and Walk throughs at the bottom of my linked pages which should help show how to use these controls.)
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..