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

Changing text colours in list box

Hi,
Can any one help me please, with a VB2005 express problem....

When writing to a list box, I need to have some lines in a different colour from others. I have tried using selection thus:

If condition listbox1.forecolour = color. red else listbox1.forecolor = color.black

but it doesn't work. This chooses and sets the colour for the first entry, all subsequent ones are then the same.

Any ideas?

Thanks Phil
Dec 19 '06 #1
1 1222
Killer42
8,435 Expert 8TB
When writing to a list box, I need to have some lines in a different colour from others. I have tried using selection thus:

If condition listbox1.forecolour = color. red else listbox1.forecolor = color.black

but it doesn't work. This chooses and sets the colour for the first entry, all subsequent ones are then the same.

Any ideas?
I think you'll find that any property such as this which is defined for the listbox will apply to all entries, not a specific one. Unless VB2005 Express is quite different to VB6 (which it is :)) I believe you will need to check out "subclassing" to achieve what you want.
Dec 22 '06 #2

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

Similar topics

3
by: NeoPhreak | last post by:
I am creating a menu for my site and I would like it so that when the onMouseOut even is triggered it will cause the cell of the table to fade out back to the normal color with a delay. Can...
4
by: david.graham18 | last post by:
Hi I spotted some nice code to change the background colour of a web page to one of four different colours at random but I can't find it now! The method was to select a number at random from 1...
10
by: st4 | last post by:
Help, As part of my family history web site i need to get 150 pages of typed text into some format to display. It just text right now but I would like to add some graphics (photos) and make the...
11
by: Hugh Janus | last post by:
OK, this is driving me crazy! As far as I can tell it should work. It compiles fine. I am saving the fore and back colour of a RTB to the registry like this: Srx.SetValue("ForeColour",...
5
by: David Cartwright | last post by:
Hi all, I'm using a DataGrid to present a tabulated list (actually a list of users logged in to my phone system) - it seemed the most appropriate control. As stuff happens on the phone system,...
3
Mague
by: Mague | last post by:
Hey, I need to change colours in a richtextbox. I am making a simple html editor. i want to make the tags different colours. I have searched google so please dont say search google. I also use...
7
by: emlimeng | last post by:
Hello, I have a label on the form to draw people's attention so they do not forget to input the data in a particular section. e.g. "Please carefully check all the options on the form". I hope I...
5
by: Jameson | last post by:
Hi, I have a list of known colours, generated using: Dim colorNames As New System.Collections.Generic.List(Of String) For Each known As KnownColor In .GetValues(GetType(KnownColor)) Dim...
0
by: Gouri.Mahajan7 | last post by:
Hello, I want to change the font of the text in richtextbox without affecting the colour of text. I want some text to be printed in different colours. When I try to change the font of the text...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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.