473,769 Members | 5,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

list view item color problem after delete

5 New Member
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(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click


objItem = lvMedic.Items.A dd("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(c ountDayLeft)
End With

If objItem.Index Mod 2 = 0 Then
objItem.BackCol or = Color.AliceBlue

ElseIf objItem.Index Mod 10 = 9 Then
objItem.BackCol or = Color.Wheat
Else
objItem.BackCol or = 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 1376
Se0ng
5 New Member
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(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click


objItem = lvMedic.Items.A dd("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(c ountDayLeft)
End With

If objItem.Index Mod 2 = 0 Then
objItem.BackCol or = Color.AliceBlue

ElseIf objItem.Index Mod 10 = 9 Then
objItem.BackCol or = Color.Wheat
Else
objItem.BackCol or = 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
2481
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 the table, as I thought a float should do, but there is white space below the table to the end of the document. Then when the second floated table comes along, it too reserves space under itself to the end of the document. The text is left in a...
2
1443
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 myDropDownList.Items.Remove(“Item1”), If I try to remove something coming from dataset, it seems I could not remove it. Is there any way to do that, or is there any why to write a SQL string and update dropdown list. Thanks, Jim.
11
8556
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 the array list again to refresh. Click on an item in the list, and an Indexing error comes up. (in non-user code, it is trying to get an element from the array that is greater than the number of items in the array.) To reproduce:
0
3240
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 way... here is my code on how I did it to help anyone starting out get an idea of how to use virtual mode in ..NET 2.0 Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared
6
2430
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 ------------------------------------------------------------------------------------------------------------------------------------ The Linked.H --- Header file #include <iostream> using namespace std;
44
3880
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 specialized for anything. Thanks, Josh McFarlane
3
3538
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 first one to the second one. I tried this once a few years ago by trying to clone the list view item so i didnt have to recreate it, but ran into the problem of the item already had a parent... i dont want to remove the items from the first list when...
4
2988
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. i=0 while(i<len(packet)-4): if packet==Packet("01110"): packet.insert(i, "01111") i+=10 #skip the 5 bits inserted, and skip the 5 bits just checked bc overlap should not trigger insertion
6
2909
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. If the user selects any of the item, that item so selected should not appear in the list again; or The user should be warned about previous selection.
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9995
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5304
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.