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

list view item color problem after delete

5
hi, I'm new to vb.net and I need some help, I done a backcolor change to my list view item as below code,

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


objItem = lvMedic.Items.Add("cb034")
With objItem
.SubItems.Add("Saliva Glukosa")
.SubItems.Add("Lotion")
.SubItems.Add("20.00")
.SubItems.Add("10")
.SubItems.Add("01/01/2005")
.SubItems.Add("01/20/2008")
.SubItems.Add(countDayLeft)
End With

If objItem.Index Mod 2 = 0 Then
objItem.BackColor = Color.AliceBlue

ElseIf objItem.Index Mod 10 = 9 Then
objItem.BackColor = Color.Wheat
Else
objItem.BackColor = Color.Cornsilk
End If
end sub

tis code work fine, but when i delete an item, the color won't change correctly, mean when i delete old index=9 item, it won't automatic change the new index=9 item color to color.wheat, anyone can provide some help?
Dec 29 '07 #1
1 1358
Se0ng
5
hi, I'm new to vb.net and I need some help, I done a backcolor change to my list view item as below code,

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


objItem = lvMedic.Items.Add("cb034")
With objItem
.SubItems.Add("Saliva Glukosa")
.SubItems.Add("Lotion")
.SubItems.Add("20.00")
.SubItems.Add("10")
.SubItems.Add("01/01/2005")
.SubItems.Add("01/20/2008")
.SubItems.Add(countDayLeft)
End With

If objItem.Index Mod 2 = 0 Then
objItem.BackColor = Color.AliceBlue

ElseIf objItem.Index Mod 10 = 9 Then
objItem.BackColor = Color.Wheat
Else
objItem.BackColor = Color.Cornsilk
End If
end sub

tis code work fine, but when i delete an item, the color won't change correctly, mean when i delete old index=9 item, it won't automatic change the new index=9 item color to color.wheat, anyone can provide some help?
Problem Solved, no Help Needed Anymore
Dec 29 '07 #2

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

Similar topics

6
by: Stan Brown | last post by:
http://www.acad.sunytccc.edu/instruct/sbrown/stat15/demo.htm http://www.acad.sunytccc.edu/instruct/sbrown/npscreen.css The first table is floated right (class="fr"). Text does not flow around...
2
by: JIM.H. | last post by:
Hello, I have a dropdown list, updated through a dataset. After bind, I use this to add extra item to my dropdown list. myDropDownList.Items.Add(“Item1”), I can remove that by using...
11
by: Zorpiedoman | last post by:
The problem is this: I have a list box. I set an array list as the datasource. I remove an item from the array list. I set the listbox datasource to nothing. I set the listbox datasource to...
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...
6
by: Rylios | last post by:
I am trying to make a very basic text editor using a linked list, fstream, sorting... This is what i have so far...
44
by: Josh Mcfarlane | last post by:
Just out of curiosity: When would using std::list be more efficient / effective than using other containers such as vector, deque, etc? As far as I'm aware, list doesn't appear to be...
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...
4
by: dustin.getz | last post by:
consider the following working loop where Packet is a subclass of list, with Packet.insert(index, iterable) inserting each item in iterable into Packet at consecutive indexes starting at index. ...
6
by: henry.onovwaka | last post by:
Can someone help on this problem. I have a combo box of, say three Items, selected from a table that serves as the lookup: E.g. 1 Earth, 2 Pine, 3 Earth Grave The combo box is on the subform. ...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...

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.