|
 |
pro_vb thread: User defined data type
Message #1 by Jason Peak <jason.peak@k...> on Tue, 12 Dec 2000 15:26:59 -0500
|
|
From the one formerly known as Biscuit (just to avoid confusion):
Ok as I understand your requirements, you want too:
- Take in a value (example showed a free character number)
- Format that value (by splitting it up equilavent to Major and Minor
version number)
- And allow the end developer an easy way of using that now formatted value
(in the example you gave showing the formatted value to the textbox)
The above was just to make sure we're on the same wave length. The main
difference as I see it between having a class and a UDT (aside from the Set
or Let argument*)
Is that with a UDT it is just a spot to store data in a logical structure
(can even contain objects) but that's it, it just stores the data, you
cannot do any processing in the UDT.
Where as with a class you can do processing. So with your requirements you
need to Format the input (ie: process the input) and so ergo you need a
class not a UDT, I don't know of any way to use a UDT in the way you wanted
(namely have the UDT do the formatting invisibly) and I'd go so far as to
say that in VB (at least prior to VB7 as that changes the rules) you can't
do it.
Hope that helps clarify that bit (this touches on to same points that maybe
not be fully clear 'specially in reference to
Objects/Classes/Structs/UDTs/etc...)
Syphtor
* A variable which is of a UDT or a predifined VB type can be assigned by
doing the following:
'-------------
Dim X as Long
X = 300
'-------------
However a variable of type Object needs to be initialized in one of two ways
(this is changing with VB7 by the way)
'-------------
Dim X as New MyObjectClass
X.Value = "Blah" ' accessing a property of the object
X = "Default" ' accessing the default property of the object
'-------------
or
'-------------
Dim X as MyObjectClass
Set X = New MyObjectClass ' Actually initializing the object
X.Value = "Blah" ' accessing a property of the object
X = "Default" ' accessing the default property of the object
'-------------
---
You are currently subscribed to pro_vb as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-pro_vb-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |