Solved

Check that a string only contains numbers

Posted on 2007-04-06
3
411 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
[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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
RLDC Reporting in Visual studio 11 44
VB.NET 2008 Winforms Signing 13 42
Generate Numbers in JQuery file 11 72
Complex SQL statement in VB.NET 7 39
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…

733 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