|
-
Feb 15th, 2002, 09:40 PM
#1
Determing Control Type
I have an object that has been referenced to a certain control on a form. That control could either be a Label, Command Button, Frame, Form or Picture. COuld someone tell me how to know what type of control the object is referenced to?
-
Feb 15th, 2002, 09:42 PM
#2
Fanatic Member
use the function: typeOf(object)
- If at first you dont succeed, then give up, cause you will never will!
-
Feb 15th, 2002, 09:43 PM
#3
PowerPoster
hi
You can use either of these
VB Code:
Private Sub Command1_Click()
Debug.Print TypeName(Command1)
If TypeOf Command1 Is CommandButton Then Debug.Print "or this"
End Sub
-
Feb 15th, 2002, 09:45 PM
#4
Fanatic Member
What is the difference between typeOf and Typename?
- If at first you dont succeed, then give up, cause you will never will!
-
Feb 15th, 2002, 09:50 PM
#5
PowerPoster
TypeOf can only be used in an If Then statement
eg If TypeOf object Is objecttype Then
whereas Typename is a function that returns the actual name and so can be used in If Thens, select case or just as a string variable.
-
Feb 15th, 2002, 09:51 PM
#6
Fanatic Member
- If at first you dont succeed, then give up, cause you will never will!
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
|