Make the form's object invisible

L'apprentis

Redcifer
Local time
Yesterday, 19:09
Joined
Jun 22, 2005
Messages
177
How would it be possible to get all the element contained in a form invisible on the open event of the same Form without Setting each single object property to invisible...
 
Suprizingly I had to do the exact same thing my self. Here is my solution.
I placed the letter R in the 'Tag' property of each of the controls I need to make invisible. I then placed this code in the forms 'On Current' event property.

Sam

Private Sub Form_Current()

Dim ctl As Control
Dim prop As Property

For Each ctl In Controls
If ctl.Properties("Tag") = "R" Then cnt.Properties("Visible") = True
If ctl.Properties("Tag") = "R" Then cnt.Properties("Visible") = False
Next cnt

End Sub
 
Suprizingly I had to do the exact same thing my self. Here is my solution.
I placed the letter R in the 'Tag' property of each of the controls I need to make invisible. I then placed this code in the forms 'On Current' event property.

Sam

Private Sub Form_Current()

Dim ctl As Control
Dim prop As Property

For Each ctl In Controls

If ctl.Properties("Tag") = "R" Then cnt.Properties("Visible") = True

Next cnt

End Sub
 
Sorry, but in the process of removing unnecessary code from my example I inadvertently made a few mistakes. Here is the corrected code.

Sam

Private Sub Form_Current()

Dim ctl As Control

For Each ctl In Controls

If ctl.Properties("Tag") = "R" Then ctl.Properties("Visible") = False

Next ctl

End Sub
 

Users who are viewing this thread

Back
Top Bottom