|
-
September 7th, 2001, 01:56 PM
#1
How can you determine the control type?
Hi,
I'm passing a control in a function and I want to determine the control type, such as combobox, textbox, etc.
I set a variable as a control. I see a name property but that is the actual name give to the control and not the control type.
How can you determine the control type?
Many thanks,
RF
-
September 7th, 2001, 02:09 PM
#2
Re: How can you determine the control type?
When you call your function you probably know which control you're sending.
So, creat your own enum and pass type of control as an additional parameter in function.
Or, save the type of the control in its 'Tag' property and then read it in the function.
-
September 7th, 2001, 02:09 PM
#3
Re: How can you determine the control type?
private Sub Command1_Click()
SomeSub Command1
End Sub
private Sub SomeSub(c as Control)
If TypeOf c is CommandButton then
MsgBox "It's a command button"
End If
If TypeOf c is ListBox then
MsgBox "It's a listbox"
End If
'etc. etc. etc....
End Sub
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
|