VBGamer |
|
Re: Determining a control type... JimmyG (0 replies, 0 views) (2001-Feb-14) Mattman,
You can't use a select case directly to do this. To evaluate the type of control object passed into a function (for instance) you use this construct:
If TypeOf (your variable) Is (Control Type) Then
The (Control Type) is the name of the control type i.e a textbox means you write TextBox, you get the idea...
as I said you can't use a select case, the following is illegal syntax:
Select Case TypeOf (your variable)
Finally, the interesting thing about the TypeOf Is construct is that it can be used for getting type information on any object, not just controls. So you could have a function that accepted any object as a parameter, and then process differently depending on the type of object passed.
In a game sense you could have a PlayDeathAnimation function and it would play different animations depending on whether you passed an alien object or a player object.
A crap example, but it should give you the idea.
Cheers,
Jimmy G |