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 :wave:
Re: Change all properties at once
Hi ! Here it's what I use
VB Code:
On Error Resume Next
For Each objControl In frMain.Controls
With objControl
If TypeOf objControl Is TextBox Then
.BackColor = vbWhite
End If
End With
Next
I hope this code will help !
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
Re: Change all properties at once
You would need to stipulate your object variable name
VB Code:
On Error Resume Next
For Each objControl In frMain.Controls
objControl.BackColor = vbWhite
Next