Wrox Programmer Forums
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials 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 June 9th, 2009, 06:42 PM
Authorized User
Join Date: Jun 2008
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Default Changing Buttons backcolor?

I have a button that the backcolor is set in the properties window as gray text from the system tab. (This is just the default backcolor setting for a button when you first put it on the form.)

In my code I change the button's backcolor to red with the following line:

Button.BackColor = Color.Red

However, I want to later on in the code change it back to the original color of the gray text. Can anyone tell me how to do this? In Color. there is a gray color but it is not the same gray. I do not know how to get the backcolor back to the systems gray text.

Any ideas?

Old June 9th, 2009, 08:43 PM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts


Can you check if the following works


C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
The Following User Says Thank You to Shasur For This Useful Post:
sanderson (June 10th, 2009)
Old June 10th, 2009, 05:52 PM
Authorized User
Join Date: Jun 2008
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Default Thank you

Wow Thank you, That worked great. I had tried all different combinations trying to use System. I just couldn't ever find the right combination. The code looks like this:

Bttn.BackColor = System.Drawing.SystemColors.GrayText

Thanks for your help!!

Similar Threads
Thread Thread Starter Forum Replies Last Post
changing the backcolor property of the textbox Fehrer Access VBA 9 April 19th, 2016 10:59 AM
Tab Control Backcolor SerranoG Access 3 February 21st, 2008 04:34 PM
Changing the BackColor property of a Form Qman69 Visual Basic 2005 Basics 0 March 14th, 2007 04:43 PM
Datagrid: cell backcolor kesar ASP.NET 2.0 Professional 1 January 12th, 2007 01:54 PM
ComboBox BackColor change LoorD C# 4 October 6th, 2005 12:44 AM

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