PC Review


Reply
Thread Tools Rate Thread

How to disable all controls in form?

 
 
Sam Kuo
Guest
Posts: n/a
 
      11th Aug 2008
I'd like to disable a large number of controls and enable a small number of
controls (within a frame in a multipage) when click a button.

I'm guessing the quickest way to do this is to disable all controls then
enable the ones I need in code? But I don't know how to disable all controls
in a short way. Any ideas?
 
Reply With Quote
 
 
 
 
Héctor Miguel
Guest
Posts: n/a
 
      11th Aug 2008
hi, Sam !

> I'd like to disable a large number of controls and enable a small number of controls
> (within a frame in a multipage) when click a button.
> I'm guessing the quickest way to do this is to disable all controls then enable the ones I need in code?
> But I don't know how to disable all controls in a short way. Any ideas?


for sure, it will depend on...
- the number (and type) of controls you need to (dis/en)able
- the layout/location/arrangement/... for these controls
- the conditions to decide which control/s shall be (dis/en)abled
- *IF* you need to control all of the above with a single button
- ???

a quick way could it be Label-controls ABOVE each "group" of controls
(set a "transparent" BackStyle and a "no border" BorderStyle for the Label-controls)
and use your button_events to handle it's .Zorder property (i.e.)

assuming only two goup of controls, each of them with a Label-control ABOVE
and two ToggleButtons to handle the .ZOrder property
try the following lines in your UserForm code module (adapt/modifi/... as needed)

Private Sub UserForm_Initialize()
Label1.ZOrder 0
Label2.ZOrder 0
End Sub
Private Sub ToggleButton1_Click()
Label1.ZOrder -ToggleButton1
ToggleButton1.Caption = IIf(ToggleButton1, "Dis", "En") & "able Group 1"
End Sub
Private Sub ToggleButton2_Click()
Label2.ZOrder -ToggleButton2
ToggleButton2.Caption = IIf(ToggleButton2, "Dis", "En") & "able Group 2"
End Sub

hth,
hector.


 
Reply With Quote
 
Sam Kuo
Guest
Posts: n/a
 
      11th Aug 2008
Hi Hector

Having read through your reply, I came to realise that perhaps it's better
(and easier) for me to disable all multipage tabs other than the one tab in
which the controls needs to be enabled, than to try and disable all controls.

Thanks for your thoughts!

Sam



"Héctor Miguel" wrote:

> hi, Sam !
>
> > I'd like to disable a large number of controls and enable a small number of controls
> > (within a frame in a multipage) when click a button.
> > I'm guessing the quickest way to do this is to disable all controls then enable the ones I need in code?
> > But I don't know how to disable all controls in a short way. Any ideas?

>
> for sure, it will depend on...
> - the number (and type) of controls you need to (dis/en)able
> - the layout/location/arrangement/... for these controls
> - the conditions to decide which control/s shall be (dis/en)abled
> - *IF* you need to control all of the above with a single button
> - ???
>
> a quick way could it be Label-controls ABOVE each "group" of controls
> (set a "transparent" BackStyle and a "no border" BorderStyle for the Label-controls)
> and use your button_events to handle it's .Zorder property (i.e.)
>
> assuming only two goup of controls, each of them with a Label-control ABOVE
> and two ToggleButtons to handle the .ZOrder property
> try the following lines in your UserForm code module (adapt/modifi/... as needed)
>
> Private Sub UserForm_Initialize()
> Label1.ZOrder 0
> Label2.ZOrder 0
> End Sub
> Private Sub ToggleButton1_Click()
> Label1.ZOrder -ToggleButton1
> ToggleButton1.Caption = IIf(ToggleButton1, "Dis", "En") & "able Group 1"
> End Sub
> Private Sub ToggleButton2_Click()
> Label2.ZOrder -ToggleButton2
> ToggleButton2.Caption = IIf(ToggleButton2, "Dis", "En") & "able Group 2"
> End Sub
>
> hth,
> hector.
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable The Controls Of One Web Form From Other Ahmad Jalil Qarshi Microsoft ASP .NET 1 20th Mar 2006 03:58 AM
Disable all controls on a form. Floyd Forbes Microsoft Access Forms 3 5th Dec 2005 12:58 PM
Form Security - Disable controls on a form mokles Microsoft Dot NET Framework Forms 0 26th Apr 2005 05:44 AM
Disable/Enable form controls from another form within the same DB. =?Utf-8?B?TGVvbmFyZCBQZWFjb2Nr?= Microsoft Access Forms 2 17th Jan 2005 12:01 AM
how to disable controls in a form Antuane Microsoft VB .NET 8 28th Nov 2004 09:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:57 PM.