Link to home
Start Free TrialLog in
Avatar of SheepDip
SheepDip

asked on

VB Items in a Frame

Hi.

Is there a way to change a common property at runtime for all the items in a frame or form?

i.e.
For each THING in thisFORM
      THING.BackColor = vbWhite
Next THING

OR for a Frame?

Cheers  

Sheepie
ASKER CERTIFIED SOLUTION
Avatar of kapil_mohta
kapil_mohta

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
SOLUTION
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
SOLUTION
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
Avatar of SheepDip
SheepDip

ASKER

Thks all.

Kept getting an error as certain objects did not have the backcolor property (and i couldn't be arsed finding out which ones - there are a lot). So dropped in the dreaded catch all on error resume next.

     For Each ctrlA In frmTicket.Controls ' Change ticket colour = SELL
            On Error Resume Next
            ctrlA.BackColor = &HC0C0FF
      Next ctrlA
      On error goto 0
 
cheers again

SD
To know the control type , you can use : typeof

i.e.
For Each ctrl In Me.Controls
    if typeof ctrl is textbox then ' say
        ctrl.BackColor = vbRed
    endif
Next

Kapil