Solved

Check that a string only contains numbers

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

777 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