473,387 Members | 1,876 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,387 software developers and data experts.

Change Color of Specific a Part in Label

I am using .Net and I want to make a specific part of a label a different text color then the label it self.

Ex.
Expand|Select|Wrap|Line Numbers
  1. lblresults.Text = "We found " + objquote.Count.ToString + " results."
The labels forecolor is Blue but I want the part "objquote.Count.Tostring" part to be red.

I dont want to use multiple labels.
Sep 19 '08 #1
1 1440
jeffstl
432 Expert 256MB
I think what you are describing is not possible without creating your own custom Label control.

The default provided Label control does not have the ability you are describing. You would have to get creative (like using 2 labels, OR you can use the <asp: Literal> control for something like that and just print out HTML formatting.

Expand|Select|Wrap|Line Numbers
  1. 'on aspx page
  2. <asp:Literal id="MyLabel" runat="server" />
  3.  
  4. 'Then in code behind or in page process:
  5. MyLabel.Text="We found <font color=blue>" & objquote.Count.ToString & " </font>results." 
  6.  
Sep 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Henning Vestergaard Poulsen | last post by:
Hi, I have a problem that I hope someone can help me with. I'm building a web page with pictures I've taken with my digital camera. I have succeded making a javacript that, when clicking on a...
2
by: knoak | last post by:
Hi there, In my form, after validation, labels of wrong fields are turned into a red color. What i want now is when you hit 'reset', to make all the labels grey again. I have the next code:...
5
by: Hank | last post by:
My Access 2000 code has been running for several years in our main plant. Now we need to install it, as a stand-along application, at remote sites, some of which are out of state. My problem is...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
0
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,...
0
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...
0
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...

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.