|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Data Type Determination
hey, guys - a quick question. I'm writing a DLL to incorporate a lot of common programming tasks that I perform, such as determining max and mins, means, averages, concatenating strings, establishing and maintaining ADO Connections, and such. In certain parts of the dll, I need to know what data type I'm working with. If I'm reading in a variant, is there any way to determine, at run time, what I have. I know there is the "IsNumeric" boolean function, but.. if I wanted to know if it was an integer, character, string, double, etc... are there intrinsic functions to do that?
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#2
|
|||
|
|||
|
__________________
How can I soar like an eagle when I'm flying with turkey's? |
|
#3
|
|||
|
|||
|
Hi fisherman!It's deeply problem that i have be puzzled by it for long time..MS vb provide some function to do it,but their function is not enough to us.I think it will be worked out by Ms programer or ourselves!It's very significative to VB developers.Some body can support this mine!?~Let's Do it Now?!
|
|
#4
|
|||
|
|||
|
|
|
#5
|
|||
|
|||
|
Thx for Doug G!
VarType Function Returns an Integer indicating the subtype of a variable. Syntax VarType(varname) The required varname argument is a Variant containing any variable except a variable of a user-defined type. Return Values Constant Value Description vbEmpty 0 Empty (uninitialized) vbNull 1 Null (no valid data) vbInteger 2 Integer vbLong 3 Long integer vbSingle 4 Single-precision floating-point number vbDouble 5 Double-precision floating-point number vbCurrency 6 Currency value vbDate 7 Date value vbString 8 String vbObject 9 Object vbError 10 Error value vbBoolean 11 Boolean value vbVariant 12 Variant (used only with arrays of variants) vbDataObject 13 A data access object vbDecimal 14 Decimal value vbByte 17 Byte value vbUserDefinedType 36 Variants that contain user-defined types vbArray 8192 Array Note These constants are specified by Visual Basic for Applications. The names can be used anywhere in your code in place of the actual values. This example uses the VarType function to determine the subtype of a variable. Dim IntVar, StrVar, DateVar, MyCheck ' Initialize variables. IntVar = 459: StrVar = "Hello World": DateVar = #2/12/69# MyCheck = VarType(IntVar) ' Returns 2. MyCheck = VarType(DateVar) ' Returns 7. MyCheck = VarType(StrVar) ' Returns 8. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Data Type Determination |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|