Link to home
Start Free TrialLog in
Avatar of Mach1pro
Mach1pro

asked on

how do you expose the properties of form controls

in Access I could do something like this:

Dim ctl as control
dim prp as property

For each ctl in me.controls
    For each prp in ctl.Properties
         debug.Print ctl.name & vbtab & prp.name
    Next prp
Next ctl

I can't seem to do this in VB6. I want to be able to loop through the controls on a form, determine if they are a certain type eg. Textbox, command button etc and then set properties on the controls like ForeColor
Avatar of leclairm
leclairm

If you want to find out the type of control, use something like:

Dim ctl As Control
For Each ctl In Me.Controls
    If TypeOf ctl Is TextBox Then
        MsgBox (ctl.Name)
    End If
Next ctl
ASKER CERTIFIED SOLUTION
Avatar of leclairm
leclairm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any luck??