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

In the ItemCheck handler of a checked ListView, how to find the Item.text value of the row whose checked value changed?

Hi,

Here's a skeleton-handler of what I'm trying to do:

private void editBbListView_ItemCheck(object sender,
System.Windows.Forms.ItemCheckEventArgs e)
{
string qEnabled = "";
string indexid = ITEM_IN_ROW_WHOSE_CHECK_JUST_CHANGED.Text;

(Update the database linked to the listview, based upon
indexid)
}

How do I determine ITEM_IN_ROW_WHOSE_CHECK_JUST_CHANGED?

I know how to determine, for example the item.text of the currently
selected row, if any. But that doesn't help here, since you can check
on/off a row without actually selecting the row.

Thanks for any ideas,

cdj

Oct 27 '06 #1
3 2299
ItemCheck is called *before* the item is changed. If you want to do
something after the item has been changed, use ItemChecked instead. You can
use e.Index to determine the item that is being processed, e.CurrentValue to
determine its current state and e.New Value to get/set the new state.

--
Regards, Peter

"sherifffruitfly" <sh*************@gmail.comskrev i meddelandet
news:11*********************@e3g2000cwe.googlegrou ps.com...
Hi,

Here's a skeleton-handler of what I'm trying to do:

private void editBbListView_ItemCheck(object sender,
System.Windows.Forms.ItemCheckEventArgs e)
{
string qEnabled = "";
string indexid = ITEM_IN_ROW_WHOSE_CHECK_JUST_CHANGED.Text;

(Update the database linked to the listview, based upon
indexid)
}

How do I determine ITEM_IN_ROW_WHOSE_CHECK_JUST_CHANGED?

I know how to determine, for example the item.text of the currently
selected row, if any. But that doesn't help here, since you can check
on/off a row without actually selecting the row.

Thanks for any ideas,

cdj

Oct 27 '06 #2

ListView.ItemCheck event:
theListView.Items[e.Index]
Note this event occurs before the check state changes.
To determine new value, check e.NewValue. You have a chance for
validation and cancel the change by setting e.NewValue to something
else, e.g. e.NewValue = e.CurrentValue.

ListView.ItemChecked event:
just use: e.Item.

Thi
http://thith.blogspot.com
sherifffruitfly wrote:
How do I determine ITEM_IN_ROW_WHOSE_CHECK_JUST_CHANGED?
Oct 28 '06 #3

Peter Thornqvist wrote:
ItemCheck is called *before* the item is changed. If you want to do
something after the item has been changed, use ItemChecked instead. You can
use e.Index to determine the item that is being processed, e.CurrentValue to
determine its current state and e.New Value to get/set the new state.
e.Index - thank you!

Oct 29 '06 #4

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

Similar topics

2
by: Mike Ruane-Torr | last post by:
I have a design problem involving a ListView control on a Windows form. What it boils down to is the following question: Q: Is there a way to tell the difference between a ListView.ItemCheck...
4
by: Ray Mitchell | last post by:
Hello, I have a standard ListView control with the CheckBox and MultiSelect properties enabled. I have an ItemCheck event set up so I can do some work every time an item is checked/unchecked. ...
4
by: Bright Sun | last post by:
Hi, I have a ListView that is shown in Details mode, and the Checkboxes property is set to true. My problem is that I dont want the checkboxes being activated when items in the ListView are...
3
by: Boris | last post by:
I wonder when CheckedListViewItemCollection is updated? Before ItemCheck event? After the event? How to force CheckedListViewItemCollection to show updated items list after check in the ItemCheck...
0
by: Richard Myers | last post by:
Hello Can anyone tell me what im missing in handling the ItemCheck event of a winforms listview. I want the item to be selected if the check box is checked and not/unhighlighted when it is not. ...
0
by: Dred | last post by:
'ello I have a listview with checkboxes displaying several options. When one is checked, all it's mutually exclusive counterparts are removed. The problem is that if I check an Item, and...
2
by: ian.watkins | last post by:
I'm having a problem with the listview itemcheck event since upgrading a smart device app from VS2003 VB.NET CF1.0 to VS2005 VB.NET CF2.0. I'm using the listview item checkbox to indicate if the...
4
by: spowel4 | last post by:
My form has a listview populated with the 50 states. When the user checks the checkbox within the listview for a particular state, I need to retrieve which state was checked (i.e. if AZ is checked...
6
by: iDesmet | last post by:
Good day! I was wondering if someone could show me the way with this little problem I have. I need to get the value/text of every checked SubItems in a listview so I can execute a Sub. The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.