Solved

Determine if the second character in a string is a number

Posted on 2006-07-23
3
166 Views
Last Modified: 2010-04-30
I am using VB6 and I need a way to determine if the second character in a string is a variable.  I found the following code:

result = (isnumber(Value(Left(myString, 2))))

There were no functions listed with this code so I thought it was using functions build into VB6, but it must not be the case because it does not work.

Does anyone know an easy way to determine if the second character in a string is a number?
0
Comment
Question by:bpl5000
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 17165049
Hi bpl5000,

If IsNumeric(Mid(myString, 2, 1)) Then
    'action for is a numeral
Else
    'action for not a numeral
End If

Regards,

Patrick
0
 
LVL 5

Author Comment

by:bpl5000
ID: 17165137
Thanks Patrick!  This works great, but I thought Left would be the way to go.  Looks like I'm wrong (again... D'oh!).  I guess if I say "If IsNumeric(Left(myString, 2)) Then"... this is looking at the first 2 characters instead of only the second character?
0
 
LVL 5

Author Comment

by:bpl5000
ID: 17165159
No need to answer that question my last question... I tried:

MsgBox Left(myString, 2)

and now I see it does give you the first two digits.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

930 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now