473,385 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple Change Label ForeColor

Newbie learning in VB.NET

Stupid question.

I have Label1.Text = "Hello World"

How do I change the Forecolor in code? I know how to set it using VS but I
want to change the Forecolor depening on certain scenerios.

Thanks!
Feb 12 '07 #1
2 12087
You would simply use the ForeColor property. If you want to set it depending
on different conditions, use an if statement like the following:

If Label1.Text <"" Then Label1.ForeColor = Color.Black

Hopefully this is enough to get you started on what you needed. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:uq**************@TK2MSFTNGP02.phx.gbl...
Newbie learning in VB.NET

Stupid question.

I have Label1.Text = "Hello World"

How do I change the Forecolor in code? I know how to set it using VS but
I want to change the Forecolor depening on certain scenerios.

Thanks!

Feb 12 '07 #2
That's perfect. Thanks!
"Nathan Sokalski" <nj********@hotmail.comwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...
You would simply use the ForeColor property. If you want to set it
depending on different conditions, use an if statement like the following:

If Label1.Text <"" Then Label1.ForeColor = Color.Black

Hopefully this is enough to get you started on what you needed. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"Phillip Vong" <phillip_vong*at*yahoo*dot*comwrote in message
news:uq**************@TK2MSFTNGP02.phx.gbl...
>Newbie learning in VB.NET

Stupid question.

I have Label1.Text = "Hello World"

How do I change the Forecolor in code? I know how to set it using VS but
I want to change the Forecolor depening on certain scenerios.

Thanks!


Feb 12 '07 #3

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

Similar topics

1
by: Eric Robishaw | last post by:
I'm adding items to a CheckBoxList Control, and need the text in each checkbox list item to be a specific color. Here's what I'm trying: ListItem li = new ListItem(GroupName, GroupID);...
4
by: rkbnair | last post by:
I have an image placed on an aspx page. <img id="xyz" onMouseOver="abc()" src="c:\temp\ijk.jpg"> My Text to Display How can I change the forecolor of the text 'My Text to display' in function...
0
by: csgraham74 | last post by:
Hi there, i have creted a datagrid control to display images using the following code. <asp:DataGrid id="dg_Properties" runat="server" HorizontalAlign="Center" Width="450px"...
1
by: Mirek Endys | last post by:
Hi all, I thought, that this is an usual thing, but Im wrong. I have a DataList control and there is a Label control. I need to change the Text propertz of the Label control. How to do it....
9
by: matt | last post by:
is it possible to change a setting, such as Forecolor for all text in a form, or do you have to change it for each text block?
3
by: rn5a | last post by:
How do I change the BorderColor of the rows under the 2nd column in a DetailsView? I could change the BorderColor of the 1st column using the FieldHeaderStyle-BorderColor property but using...
1
by: dhaneshrs | last post by:
I have a small code that shows inactive and active users from the ms access DB. <%@ Page Language="VB" MasterPageFile="~/MasterPageAdmin.master" Title="Welcome" %> <%@ Import...
6
by: AAaron123 | last post by:
I'm using the CreateUserWizard Web Server Control The error message when the passwords do not match is colored red. Red does not show well against my background so I like to change that color. I...
3
by: crjunk | last post by:
Hi Everyone, I have a web form that I would like to enhance. What I'd like to do is this: A user adds/edits the text in a textbox. I want the adjoining label to change color. Example: User...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.