Results 1 to 4 of 4

Thread: Change all properties at once

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Arrow Change all properties at once

    Hi
    How can I change all object properties of my form with one command,I know there's a way and it's easy but I can't remember it...

    For example I have a few text boxex, commands buttons, labels...and I want to set their background color with one line of code...

    How do I do this ?!
    Thankyou
    Horazio

  2. #2
    Hyperactive Member DubweiserTM's Avatar
    Join Date
    Dec 2005
    Location
    St-Ferdinand, Québec
    Posts
    427

    Re: Change all properties at once

    Hi ! Here it's what I use
    VB Code:
    1. On Error Resume Next
    2.         For Each objControl In frMain.Controls
    3.                 With objControl
    4.                         If TypeOf objControl Is TextBox Then
    5.                                 .BackColor = vbWhite
    6.                         End If
    7.                 End With
    8.         Next
    I hope this code will help !
    DubweiserTM

    If your question has been answered, you can mark a thread as resolved...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2006
    Location
    Paris
    Posts
    301

    Re: Change all properties at once

    ..and what about this, is it possible ?!?

    On Error Resume Next
    For Each objControl In frMain.Controls

    .BackColor = vbWhite
    Next

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Change all properties at once

    You would need to stipulate your object variable name
    VB Code:
    1. On Error Resume Next
    2. For Each objControl In frMain.Controls
    3.      objControl.BackColor = vbWhite
    4. Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width