|
-
Apr 8th, 2006, 01:31 AM
#1
Thread Starter
Addicted Member
Determine Variant Data Type (wrt Hard Data Types) [Resolved]
Hi,
I am using a variant parameter in a function to simplify my UI for a control. When that funciton is called, the variant parameter will either be a string or a long. I need to determine which has been passed.
(One problem is that a string argument can begin with a number, so that rules out using the VAL function.)
(Since the argument is not an object, I cannot use the IS operator.)
How can I determine the data type of the variant within the function?
Cheers,
Nap.
Last edited by Napoleon; Apr 8th, 2006 at 02:55 AM.
-
Apr 8th, 2006, 01:44 AM
#2
Re: Determine Variant Data Type (wrt Hard Data Types)
Would this work?
VB Code:
Private Sub Form_Load()
GetType "1231ABC"
End Sub
Private Sub GetType(StrVal As Variant)
If IsNumeric(StrVal) Then
MsgBox "Is a number"
Else
MsgBox "Is a string"
End If
End Sub
-
Apr 8th, 2006, 02:54 AM
#3
Thread Starter
Addicted Member
Re: Determine Variant Data Type (wrt Hard Data Types)
-
Apr 8th, 2006, 02:57 AM
#4
Re: Determine Variant Data Type (wrt Hard Data Types) [Resolved]
-
Apr 8th, 2006, 11:39 AM
#5
Thread Starter
Addicted Member
Re: Determine Variant Data Type (wrt Hard Data Types) [Resolved]
Penagate,
I will use that one.
It covers all the core variable types that VB has.
Thanks,
Nap
-
Apr 8th, 2006, 01:09 PM
#6
Re: Determine Variant Data Type (wrt Hard Data Types) [Resolved]
I see that you took the trouble to edit your subject to add Resolved. Thanks for doing that but the easy way is to pull down the Thread Tools menu and click the Mark Thread Resolved button.
-
Apr 8th, 2006, 03:11 PM
#7
Thread Starter
Addicted Member
Re: Determine Variant Data Type (wrt Hard Data Types) [Resolved]
Thanks for the info. Didn't know it was there.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|