Enable/Disable user controls in Windows Form 
Author Message
 Enable/Disable user controls in Windows Form

I must be missing something.  All I want to do is disable
a set of controls on my (Windows .Net) form at certain
times.  They are mostly TextBoxes and ComboBoxes.  When
disabled, these controls will contain valid information
that the user needs to see.  The problem is that my user
doesn't like the color combination of the disabled
controls (if the text would remain Black, it would be
fine).  Is there a reasonably simple way to do this?  I
have tried a number of approaches, but none works well.  I
need a way do accomplish this without referencing each
control by specific name.  Using the ReadOnly property
would solve the problem, but this property is not
available for ComboBoxes, and not available in the
collection of controls, as follows:

for each Control in Container
  Control.Enabled = False  ' works fine, but bad colors
  Control.ReadOnly = True  ' fails -- no such animal
next

Is there a way to change the color settings for a disabled
control?  That would be the easiest way to handle this.

I've also tried emulating the ReadOnly behavior in a Sub
by capturing and rejecting keyboard characters when the
controls should not be available.  It would have worked
beautifully, but for some crazy reason the "Delete" key
does not raise the KeyPress event.  By the way, what's up
with that?  How can a certain key not get trapped by the
KeyPress event?

Anyway, I'm about out of things to try.  Anybody got a
good idea for me?

Thanks much.



Wed, 02 Mar 2005 01:53:38 GMT  
 Enable/Disable user controls in Windows Form
Even though this isn't a DotNet group, there are pro's and con's to
disabling controls without making them look disabled.. one easy way to
disable a group of controls without effecting their appearance is to drop
them all into a frame (border/caption optional) and disable the frame.

--
Ken Halter - MS-MVP-VB - Please keep it in the groups..
http://www.vbsight.com - http://www.vbsight.com/MultiColumn.htm
New Tabbed Dialog http://www.vbsight.com/TBGDialogCTL.htm



Quote:
> I must be missing something.  All I want to do is disable
> a set of controls on my (Windows .Net) form at certain
> times.  They are mostly TextBoxes and ComboBoxes.  When
> disabled, these controls will contain valid information
> that the user needs to see.  The problem is that my user
> doesn't like the color combination of the disabled
> controls (if the text would remain Black, it would be
> fine).  Is there a reasonably simple way to do this?  I
> have tried a number of approaches, but none works well.  I
> need a way do accomplish this without referencing each
> control by specific name.  Using the ReadOnly property
> would solve the problem, but this property is not
> available for ComboBoxes, and not available in the
> collection of controls, as follows:

> for each Control in Container
>   Control.Enabled = False  ' works fine, but bad colors
>   Control.ReadOnly = True  ' fails -- no such animal
> next

> Is there a way to change the color settings for a disabled
> control?  That would be the easiest way to handle this.

> I've also tried emulating the ReadOnly behavior in a Sub
> by capturing and rejecting keyboard characters when the
> controls should not be available.  It would have worked
> beautifully, but for some crazy reason the "Delete" key
> does not raise the KeyPress event.  By the way, what's up
> with that?  How can a certain key not get trapped by the
> KeyPress event?

> Anyway, I'm about out of things to try.  Anybody got a
> good idea for me?

> Thanks much.



Wed, 02 Mar 2005 02:15:13 GMT  
 Enable/Disable user controls in Windows Form
Sorry about posting to wrong area.

These controls do currently live in a Panel container.  I
can disable the panel, and all the controls in it do in
fact become disabled.  The issue of them looking disabled
however, is not solved.

???

Quote:
>-----Original Message-----
>Even though this isn't a DotNet group, there are pro's
and con's to
>disabling controls without making them look disabled..
one easy way to
>disable a group of controls without effecting their

appearance is to drop
Quote:
>them all into a frame (border/caption optional) and
disable the frame.

>--
>Ken Halter - MS-MVP-VB - Please keep it in the groups..
>http://www.vbsight.com -

http://www.vbsight.com/MultiColumn.htm
Quote:
>New Tabbed Dialog http://www.vbsight.com/TBGDialogCTL.htm

>"Frustrated and Perturbed"


Quote:

>> I must be missing something.  All I want to do is
disable
>> a set of controls on my (Windows .Net) form at certain
>> times.  They are mostly TextBoxes and ComboBoxes.  When
>> disabled, these controls will contain valid information
>> that the user needs to see.  The problem is that my user
>> doesn't like the color combination of the disabled
>> controls (if the text would remain Black, it would be
>> fine).  Is there a reasonably simple way to do this?  I
>> have tried a number of approaches, but none works
well.  I
>> need a way do accomplish this without referencing each
>> control by specific name.  Using the ReadOnly property
>> would solve the problem, but this property is not
>> available for ComboBoxes, and not available in the
>> collection of controls, as follows:

>> for each Control in Container
>>   Control.Enabled = False  ' works fine, but bad colors
>>   Control.ReadOnly = True  ' fails -- no such animal
>> next

>> Is there a way to change the color settings for a
disabled
>> control?  That would be the easiest way to handle this.

>> I've also tried emulating the ReadOnly behavior in a Sub
>> by capturing and rejecting keyboard characters when the
>> controls should not be available.  It would have worked
>> beautifully, but for some crazy reason the "Delete" key
>> does not raise the KeyPress event.  By the way, what's
up
>> with that?  How can a certain key not get trapped by the
>> KeyPress event?

>> Anyway, I'm about out of things to try.  Anybody got a
>> good idea for me?

>> Thanks much.

>.



Wed, 02 Mar 2005 03:36:59 GMT  
 Enable/Disable user controls in Windows Form
Then you run through the controls list and set the disabled property of each
constituent control to False.



Quote:
> Sorry about posting to wrong area.

> These controls do currently live in a Panel container.  I
> can disable the panel, and all the controls in it do in
> fact become disabled.  The issue of them looking disabled
> however, is not solved.

> ???

> >-----Original Message-----
> >Even though this isn't a DotNet group, there are pro's
> and con's to
> >disabling controls without making them look disabled..
> one easy way to
> >disable a group of controls without effecting their
> appearance is to drop
> >them all into a frame (border/caption optional) and
> disable the frame.

> >--
> >Ken Halter - MS-MVP-VB - Please keep it in the groups..
> >http://www.vbsight.com -
> http://www.vbsight.com/MultiColumn.htm
> >New Tabbed Dialog http://www.vbsight.com/TBGDialogCTL.htm

> >"Frustrated and Perturbed"


> >> I must be missing something.  All I want to do is
> disable
> >> a set of controls on my (Windows .Net) form at certain
> >> times.  They are mostly TextBoxes and ComboBoxes.  When
> >> disabled, these controls will contain valid information
> >> that the user needs to see.  The problem is that my user
> >> doesn't like the color combination of the disabled
> >> controls (if the text would remain Black, it would be
> >> fine).  Is there a reasonably simple way to do this?  I
> >> have tried a number of approaches, but none works
> well.  I
> >> need a way do accomplish this without referencing each
> >> control by specific name.  Using the ReadOnly property
> >> would solve the problem, but this property is not
> >> available for ComboBoxes, and not available in the
> >> collection of controls, as follows:

> >> for each Control in Container
> >>   Control.Enabled = False  ' works fine, but bad colors
> >>   Control.ReadOnly = True  ' fails -- no such animal
> >> next

> >> Is there a way to change the color settings for a
> disabled
> >> control?  That would be the easiest way to handle this.

> >> I've also tried emulating the ReadOnly behavior in a Sub
> >> by capturing and rejecting keyboard characters when the
> >> controls should not be available.  It would have worked
> >> beautifully, but for some crazy reason the "Delete" key
> >> does not raise the KeyPress event.  By the way, what's
> up
> >> with that?  How can a certain key not get trapped by the
> >> KeyPress event?

> >> Anyway, I'm about out of things to try.  Anybody got a
> >> good idea for me?

> >> Thanks much.

> >.



Sat, 05 Mar 2005 00:58:51 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Enable/Disable Windows Forms Controls

2. Enabling and Disabling a user control

3. Enable/Disable Users

4. Disable/Enable a NIC in Windows 2000

5. Disable/Enable a NIC in Windows 2000

6. enable/disable User Accounts

7. Enable and Disable Windows

8. Disable/Enable a NIC in Windows 2000

9. How do you conditionally disable/enable a field on a form

10. I cant disable/enable my form!!??

11. How do I enable and disable menu items on the parent form

12. disabling the DISABLE/ENABLE macros menu on opening spreadsheet

 

 
Powered by phpBB® Forum Software