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

Problem in List

Hi All,

I am having problem in ListViewControl which has items with CheckBoxes.

When I use the CheckState event,

the ListViewItem whatever I checked still contains the old CheckState and
has not changed to the new CheckState.

Is this a bug?

Any suggestions please?

Thanks
Anand Ganesh
Nov 16 '05 #1
3 1131
No, it's not a bug. The event fires _before_ the change takes place in
the list view. You have to use the event arguments to determine what
the new state will be.

Nov 16 '05 #2
Hi Bruce,

Thanks for the Info.

Now this is getting more interesting.

I have a situation like this.

I want to collect all the items that is checked.

I wrote a loop to go through all the items and was checking item.checked ==
true ; so in this case the currently checked item was not showing up as
checked. Because I was using Check_Event and this event fires up before the
change.

So how will I solve this problem?

Thanks for helping me out.

Regards
Anand

"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
No, it's not a bug. The event fires _before_ the change takes place in
the list view. You have to use the event arguments to determine what
the new state will be.


Nov 16 '05 #3
Here is an (untested) example that I threw together from some code I
have:

private void listview_ItemCheck(object sender, ItemCheckEventArgs ice)
{
ArrayList checked = new ArrayList();
foreach (ListViewItem lvi in listview.CheckedItems)
{
if (lvi.Index == ice.Index)
{
if (ice.NewValue == CheckState.Checked)
{
checked.Add(lvi);
}
// otherwise exclude the list item from the "checked"
// list because its new state is "UnChecked".
}
else
{
checked.Add(lvi);
}
}
.... do something with the "checked" list ...
}

Nov 16 '05 #4

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

Similar topics

5
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the...
10
by: Michael Strorm | last post by:
Hi! I've been having problems with a DTD. Having had the Sun XML validator reject a document, I put it through 'xmllint' for more information. 'Xmllint' noted a problem with the DTD itself;...
2
by: Pascal Deparis | last post by:
Hi, I've got a problem with the DB2 Command Line Processor, in V8, FP1. The databases have been created on an AIX server (version 4.3.3). Have a look at this: >db2 ? list DB21034E The...
5
by: John N. | last post by:
Hi All, Here I have a linked list each containing a char and is double linked. Then I have a pointer to an item in that list which is the current insertion point. In this funtion, the user...
57
by: Xarky | last post by:
Hi, I am writing a linked list in the following way. struct list { struct list *next; char *mybuff; };
1
by: cody | last post by:
I have a OOP problem with the well known pattern where objects containing an object which represents a list of subobjects. Now my problem is that the ctor of a subobject indirectly calls the...
14
by: rurpy | last post by:
Another Python docs problem... I was trying to use imp.find_module(). >>> imp.find_module("mymod", "./subdir") ImportError: No frozen submodule named ./subdir.mymod subdir/mymod.py...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
7
by: Fernando Barsoba | last post by:
Hi, After following the advice received in this list, I have isolated the memory leak problem I am having. I am also using MEMWATCH and I think it is working properly. The program does some...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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...

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.