Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Intermediate
Aug 20, 1997

Disabling All Controls on a Form

If you ever need to disable all the controls on a form you can loop through the control array and set each Enabled property to False with this code:
 Sub cmdArray_Click () 
Dim iLoop As Integer 

For iLoop = 0 To Me.Controls.Count - 1 
Me.Controls(iLoop).Enabled = False 
Next iLoop 
End Sub 
An alternatively is to set the Enabled property of the form to False, which effectively disables the entire form:
 Me.Enabled = False 
There is a side effect to the second method, however: because you can't use the control menu from the form, there is no way to close the form. You'll need to have another form unload this disabled form.
Paul D. Sheriff
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap