473,396 Members | 2,018 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,396 software developers and data experts.

Problem with ForeColor with Listview

I have the following code below. The objective is to change the forecolor of
the item if the item being added is different from the last item. Well it's
not working. When I step thru the code it's going to the correct areas when
the lastitem not equal to current item but it's not changing the foreground
color. Any ideas why. Thanks

Do
line = sr.ReadLine()
If line Is Nothing Then
Else
If LastItem <> ListItem(line) Then
LastItem = ListItem(line)
ListView1.ForeColor = Color.Red
ListView1.Items.Add(line)
Else
LastItem = ListItem(line)
ListView1.Items.Add(line)
End If
End If
ListView1.ForeColor = Color.Black
Loop While Not line Is Nothing
Jun 23 '06 #1
1 1633
Mike,

Although your question is the same in all languages, is it because you show
it in VBNet, probably a better question for one of the most active developer
newsgroups

microsoft.public.dotnet.languages.vb

You have of course not to change the color of your listview but the items,
that is so nice from the listview it exist from independend items. However I
never did that and in the newsgroup languages.vb are probably a lot who can
give you the answer direct.

However, I found this, so maybe this helps you.

http://msdn2.microsoft.com/en-us/library/w1s4137w.aspx

Cor

"Mike Johnson" <Mi*********@discussions.microsoft.com> schreef in bericht
news:8C**********************************@microsof t.com...
I have the following code below. The objective is to change the forecolor
of
the item if the item being added is different from the last item. Well
it's
not working. When I step thru the code it's going to the correct areas
when
the lastitem not equal to current item but it's not changing the
foreground
color. Any ideas why. Thanks

Do
line = sr.ReadLine()
If line Is Nothing Then
Else
If LastItem <> ListItem(line) Then
LastItem = ListItem(line)
ListView1.ForeColor = Color.Red
ListView1.Items.Add(line)
Else
LastItem = ListItem(line)
ListView1.Items.Add(line)
End If
End If
ListView1.ForeColor = Color.Black
Loop While Not line Is Nothing

Jun 24 '06 #2

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

Similar topics

0
by: timtos | last post by:
I just started to create my own ListView control and already have big problems... I use the following code at the moment: protected override void OnPaint(PaintEventArgs pe) {...
4
by: Tom John | last post by:
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: ...
6
by: marfi95 | last post by:
I'm trying to display something like a grid with a listview, where the first column is grayed and has an indicator in it that tells the user that row has been processed. I would really like to...
4
by: Rod Gill | last post by:
Hi, I have a form that when opened in the designer appears of the screen. The form selector can't be dragged (or resized) and if I scroll right and down to centralise it the form simply jumps...
7
by: Dino Buljubasic | last post by:
Hi, I am using C# 2.0 (VS2005) to build my user control that contains a number of dynamically loaded ListViews. ListViewItems have their ForeColor properties set to either black or blue to...
2
by: Xafier | last post by:
Hi, I'm creating a control that overrides ListView and so I'm working on redrawing everything myself with some changes here and there... But I'm having a problem with drawing the text inside...
4
by: murthyspd | last post by:
Hi I have placed a listview on my Access form. There are certain reminders that I am sending through this listview. If the task is 2 days old and not yet completed, it should appear in red....
0
by: grappeggia | last post by:
Hi everybody, I`m doing a project in which a microcontroller realises an A/D conversion of 8 channels and send then to the computer using the USB, over one serialport interface. On the PC, I`m...
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
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...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.