How can we determine the type of a control in VB
I need to determine the type of each control on the form. That is I need to check whether a control is commandButton or checkbox etc. Using the Controls collection I can traverse through all the controls on the form, but how can i check their types?
Ali.
Re: How can we determine the type of a control in VB
Use TypeOf(). Be sure to use Is for comparison.
Dim aControl as Control
for each aControl in Controls
If TypeOf(aControl) is CommandButton then
MsgBox aControl.Name
End If
next