?
Solved

Check that a string only contains numbers

Posted on 2007-04-06
3
Medium Priority
?
419 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 2000 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

Independent Software Vendors: 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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
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 …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

830 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