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

List View Cololurs

I've not programmed for a while in VB 2003... but I've decided to modlfiy a
Project I have.

Seems simple enough... I've a List Box... I fill it with about 30 lines of
data (3-4 columns).

What I want to do is to be able to List the ROWS of data either a RED or GREEN
colour depending upon an IF statement.

So... IF X =< myVariable then Row would be GREEN ELSE Row would be RED.

Orignally (before I tried to change the Colour) I had:

'Display All Results

LvItem = New ListViewItem
LvItem.Text = reqWire
LvItem.SubItems.Add(AcVolts)
LvItem.SubItems.Add(AcVoltLoss)
lvResults.Items.Add(LvItem)
Now I've (I get a colour... but all rows are the same):

'Display All Results

Dim lvs As New ListViewItem.ListViewSubItem
Dim LItem As ListViewItem
Dim nwClrA, nwClrB As Color
nwClrA = Color.PaleGreen ' Equal to or Less Than
nwClrB = Color.Salmon ' Greater Than

LvItem = New ListViewItem
LvItem.Text = reqWire
LvItem.SubItems.Add(AcVolts)
LvItem.SubItems.Add(AcVoltLoss)
If AcVoltLoss = maxVd Then
' Change Color of Items
lvs = LvItem.SubItems(0) ' Required Wire
lvs.BackColor = nwClrA
lvs = LvItem.SubItems(1) ' Volt Loss
lvs.BackColor = nwClrA
lvs = LvItem.SubItems(2) ' Volt Loss %
lvs.BackColor = nwClrA
Else
lvs = LvItem.SubItems(0) ' Required Wire
lvs.BackColor = nwClrB
lvs = LvItem.SubItems(1) ' Volt Loss
lvs.BackColor = nwClrB
lvs = LvItem.SubItems(2) ' Volt Loss %
lvs.BackColor = nwClrB
End If ' Update ListView
lvResults.Items.Add(LvItem)

So what am I doing wrong??

Thanks in advance!

BruceF
Dec 21 '07 #1
0 911

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

Similar topics

1
by: Yuki | last post by:
I am trying to find out if I can have a specific record that has been selected in a list box be opened in datasheet view. I can't seem to find where this can happen or what I need to use to make...
11
by: Brian Henry | last post by:
Well here is the problem, I have a data set with about 9,000 to 20,000 people in it in the data table "people"... I am then reading it into a list view one at a time row by row... adding each...
0
by: Brian Henry | last post by:
Since no one else knew how to do this I sat here all morning experimenting with this and this is what I came up with... Its an example of how to get a list of items back from a virtual mode list...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
3
by: Brian Henry | last post by:
So what is the easiest way to do this? I have one list view with a list of items (in detail view and with about 20 sub items) and a second list view that will take the items they drag from the...
2
by: probashi | last post by:
Hi, Using the SqlDataSource/SelectParameters/ControlParameter one can easily bind a Grid View with a list box (or any other controls), pretty cool, but my list box is multi select. My...
5
by: zefciu | last post by:
Hi! I want to embed a function in my python application, that creates a two-dimensional array of integers and passes it as a list (preferably a list of lists, but that is not necessary, as the...
3
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
I've a multiview with 3 views. on view 2 the user is presented with a check box list (items from database) at view 3 the user can review their selections and, either post to the database or go back...
2
by: Mohit | last post by:
Hi all, I am working on a windows application with a list view on a form. Now I wanted to show hand cursor when mouse is over list view item and default(arrow) cursor at other places. List...
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: 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
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.