Check that a string only contains numbers

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 where each x represents a number only.  The format for the command is '.freq1".  

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.
LVL 16
Ady FootSharePoint ConsultantAsked:
Who is Participating?
sirbountyConnect With a Mentor Commented:
Something like...

If Not IsNumeric(txtFrequency.Text.SubString(7,7)) Then
 MessageBox ("Not a valid frequency!")
 Exit Sub
End If
Ady FootSharePoint ConsultantAuthor Commented:
Great stuff and the quick response is much appreciate....this was holding me up a little.

Thanks a lot for your help.
Glad I could help! :^)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.