473,513 Members | 2,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListView Subitem Forecolor problem

Hi

I have a ListView that i want to be able to modify the color of
particular items depending on whether the value of the item they are
about to be replaced with is higher, lower or the same:

With QueueListItem.SubItems(ItemCount)
If .Text = DataRow.Item(ItemCount) Then
.ForeColor = Color.Black
ElseIf .Text < DataRow.Item(ItemCount) Then
.ForeColor = Color.Red
ElseIf .Text > DataRow.Item(ItemCount) Then
.ForeColor = Color.Green
End If
.Text = DataRow.Item(ItemCount)
End With

However the color of the items always remain black. If i stick a
message at the end:

msgbox(.ForeColor) it returns the colour i just set it to which is a
bit wierd i think.

Any ideas?

Thanks

Tom
Nov 20 '05 #1
4 5599
It sounds like you might need to call Invalidate to get the control to
repaint.

Adios,
January

"Tom John" <ne**@leeksoft.com> wrote in message
news:9o********************************@4ax.com...
Hi

I have a ListView that i want to be able to modify the color of
particular items depending on whether the value of the item they are
about to be replaced with is higher, lower or the same:

With QueueListItem.SubItems(ItemCount)
If .Text = DataRow.Item(ItemCount) Then
.ForeColor = Color.Black
ElseIf .Text < DataRow.Item(ItemCount) Then
.ForeColor = Color.Red
ElseIf .Text > DataRow.Item(ItemCount) Then
.ForeColor = Color.Green
End If
.Text = DataRow.Item(ItemCount)
End With

However the color of the items always remain black. If i stick a
message at the end:

msgbox(.ForeColor) it returns the colour i just set it to which is a
bit wierd i think.

Any ideas?

Thanks

Tom

Nov 20 '05 #2
On Mon, 24 Nov 2003 11:33:34 -0600, "January Smith"
<ja*****@texas.net> wrote:
It sounds like you might need to call Invalidate to get the control to
repaint.

Adios,
January


Jannuary, thanks but the problem still exists.
Nov 20 '05 #3
With Deft Fingers, Tom John <ne**@leeksoft.com> wrote:
I have a ListView that i want to be able to modify the color of
particular items depending on whether the value of the item they are
about to be replaced with is higher, lower or the same:

With QueueListItem.SubItems(ItemCount)
If .Text = DataRow.Item(ItemCount) Then
.ForeColor = Color.Black
ElseIf .Text < DataRow.Item(ItemCount) Then
.ForeColor = Color.Red
ElseIf .Text > DataRow.Item(ItemCount) Then
.ForeColor = Color.Green
End If
.Text = DataRow.Item(ItemCount)
End With


I think you need something like:

'Enables Show SubItems in Differnt Colours
LItem.UseItemStyleForSubItems = False

I had to use the above to have the background colours happen...

Regards,

Bruce
Nov 20 '05 #4
> 'Enables Show SubItems in Differnt Colours
LItem.UseItemStyleForSubItems = False


Fantastic... Thanks!

Nov 20 '05 #5

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

Similar topics

2
21205
by: John Lauwers | last post by:
I know you can edit the first column of the listview control, is there a way to edit the second and/or the other columns? greets John
6
2303
by: Richard | last post by:
Hi. I use a ListView to display data in tabular form. Each ListView row corresponds to a data record. The ListView Item of the record is the record key or code. Each SubItem in that row...
1
23655
by: andrewcw | last post by:
The clcik event on the ListView control seems to trigger off the item level ( the first column ). I would like to be able to trap the click event on a particular subitem ( a specific column's row...
20
6608
by: Ash Phillips | last post by:
Hi Everyone, I have this program I wrote in VB6 for family use. It's a DVD Database just for me to keep track of them cause I have so many lol. In VB6, I could add items to the ListView in...
6
5018
by: Jack | last post by:
Hello, I've noticed through searching this group's previous posts that one can get the item the mouse is over in a listview control but I did not see how to get the subitem the mouse is over. Is...
5
2359
by: Martin Horn | last post by:
Hi all, I want to implement a listview with editable subitems and I assume the easiest way is to overlay a textbox over the item to be edited. With this in mind I have come up with: Using...
10
12253
by: Adam Honek | last post by:
This is probably a silly question but oh well, I can't find the answer looking via code. Having an imagelist already, how does one set an icon for a list view's sub items? I'm using the code...
1
5186
by: plmanikandan | last post by:
Hi, I have a listview with items,subitems.I tems and subitems are added as below listView1.View = View.Details; listView1.Columns.Add("Column 1", 100,HorizontalAlignment.Center);...
1
6398
by: James | last post by:
Hi All, I have an ownerdraw ListView control. I'm trying to use an ownerdrawn ListView control to draw and display images in the second column of a listview which is set to detail view. I...
0
7264
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
7166
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
7386
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
7534
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...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4749
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...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3226
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
459
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...

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.