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
Solved

Check that a string only contains numbers

Posted on 2007-04-06
3
410 Views
Last Modified: 2012-06-22
Hi guys,

I have a text box that is used to enter commands into my application.  One of these commands is to allow the user to select a new frequency.  Frequencies are always entered in the format 1xx.xxx where each x represents a number only.  The format for the command is '.freq1 1xx.xxx".  

I split the string down to, what should be, a resulting two strings of three characters each.  How do check that the user has only entered numbers?  This is important otherwise I'll end up attempting to set the frequency incorrectly.

Many thanks.
0
Comment
Question by:Ady Foot
  • 2
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18866263
Something like...

If Not IsNumeric(txtFrequency.Text.SubString(7,7)) Then
 MessageBox ("Not a valid frequency!")
 Exit Sub
End If
0
 
LVL 16

Author Comment

by:Ady Foot
ID: 18866297
Great stuff and the quick response is much appreciate....this was holding me up a little.

Thanks a lot for your help.
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18866310
Glad I could help! :^)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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