Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2004, 10:14 AM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing colors of numerous disabled controls

I read the post about how to change foreground color of disabled control. I have a similar problem in that the default colors for disabled controls are hard to read. However, I have a lot of controls to work with. I have set up my app with tab pages and depending on the security settings of the user, I set Enabled to False for specific tab pages. They are allowed to view the pages, just not change the data them. Each tab page has anywhere from 25-40 controls (very data intensive app). To have to set each control to readonly or do anything to it individually would be a royal pain. The tab page doesn't seem to have a Readonly property, so I can't go that route. Anyone have any ideas? Thanks for your help!
 
Old February 11th, 2004, 10:16 AM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, forgot to mention this is a Windows app.
 
Old February 25th, 2004, 05:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Here is how you would disable all of the controls on a single tabpage:

Dim ctrl As Control

For Each ctrl In Me.[tabpagename].Controls
      ctrl.Enabled = False
Next

J
 
Old February 26th, 2004, 06:18 AM
Registered User
 
Join Date: Feb 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply! I've already disabled the controls on the page by disabling the tab page itself, which effectively disables the controls. My problem was with the colors for disabled controls. I suppose I could use this code to set it to readonly instead which wouldn't change the colors. I already worked around it by leaving the controls enabled and setting the focus to the tab control if you click on any control within the page that should be disabled (got this idea from a reply to that original post). It worked for most controls but not for check boxes or datetimepicker controls. I had to write some code to undo the click action and then take you to the tab page. It looks fine on the screen but it's a bit messy in the code.

MK





Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the colors of items in a listbox Thorgal ASP.NET 2.0 Professional 0 June 7th, 2006 02:37 AM
How to bind colors to controls in an formview leverell ASP.NET 2.0 Professional 0 May 31st, 2006 02:00 AM
problems changing colors demdivers VB.NET 2002/2003 Basics 0 September 27th, 2005 08:07 AM
changing colors in standards controls gbianchi Pro VB 6 6 September 22nd, 2005 03:11 PM
Changing colors of numbers - forumla wise? drarem Excel VBA 1 April 20th, 2004 08:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.