473,668 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Change a Label's BackColor Property

Greetings,

I have a very "novice" question to ask, so hopefully it will be easy.
At any rate, I have a label on a Windows form called "label1". I simply
want to change the "backcolor" property to a different color (e.g.,
"blue"), but I haven't figured out how to do it. I want to do this when
the user clicks a button. Any ideas?

Thanks in advance!
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
3 18882
All you do is

label1.BackColo r = Color.Aqua

Where label1 is the name of the label you want to change. Using Color
you could change it to any color you want.

Nov 17 '05 #2
On the form where these two controls are, double click the button that
you want to use to change the label's color. This will bring you to the
button's click event. In the braces for this routine, put the
following:

this.label1.Bac kColor = Color.Blue;

Once you build and run the app, clicking on the button thould set the
BackColor of the label blue.

Nov 17 '05 #3
Thank you both. I greatly appreciate it!

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1343
by: Bennett Haselton | last post by:
I've created a Web application project called WebApplication1. When I go into the properties dialog for the project, under Common Properties->Web Settings it lists "Web Server Information", including: Web Server: brainjammer.web103.discountasp.net but that property is greyed out so that I can't edit it. Is there any supported way to edit that property? The proper hostname for the server is now www.brainjammer.com and that's what I...
2
2084
by: Sjaakie Helderhorst | last post by:
Hi there, I created my own user control (myControl) containing: myCaption - docked top myGrid - docked.fill (datasource: myDataset) myPanel - docked bottom This control is added to the form: form1.controls.add(myControl) I wish to change label-value on myPanel whenever a value of myDataset has changed (by editing the grid). Since dataset.onchange doesn't exists, what
6
9156
by: Roger Ries via DotNetMonster.com | last post by:
I'm trying to change the text in a label from another form. lblInfo.Text = "ABC" Works for the form your currently in but how the heck do you change that label information from another form. Later --
1
8305
by: Dean Slindee | last post by:
The code below runs in the form_paint event but changes nothing, anyone got a better idea or why this code is not effective? Imports System.Drawing.Drawing2D Dim ctl As Control Dim str As String For Each ctl In Me.Controls
3
1645
by: david | last post by:
I have written JavaScript and try to change the radio button property (disenable other radio buttons) once click on it. But it does not work. For example, I have radio buttons A, B, and C. A and B are in the same group AB. When A is selected, C is enabled; otherwise, C is disabled. MY code is: JavaScript: function enableC(){ document.Form1.C.enabled = true; }
0
1051
by: Carlos Barini | last post by:
I need to change the "Column.BackColor" when the user clicks the ColumnHeader. How can I do that? Tks. Carlos Barini. Brazil.
1
2939
by: kostareject | last post by:
Hello! Can anyone tell me how can I printi label/textbox Text property in MDI Child by clicking MDI Parent print button in C#! I have MDI Chil form with several labels and textboxes, and I want to print its content(label.text and/or textbox.text). Also I would like to see that in print preview dialog. The picture is in attachment... Please Help! Thanks!
0
1718
by: kostareject | last post by:
Hello! Can anyone tell me how can I printi label/textbox Text property in MDI Child by clicking MDI Parent print button in C#! I have MDI Chil form with several labels and textboxes, and I want to print its content(label.text and/or textbox.text). Also I would like to see that in print preview dialog. The picture is in attachment... Please Help! Thanks!
5
13837
by: yappy77 | last post by:
I am trying to change the label color of a checkbox on a subform if it is checked. The code I have so far is: Private Sub Emergency_Contact_Click() If Me.Emergency Contact = True Then Me.Label23.BackColor = vbYellow Me.Label23.BackStyle = 1 Else Me.Label23.ForeColor = RGB(0, 0, 0)
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8378
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.