473,738 Members | 4,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(objec t sender,
System.Windows. Forms.ItemCheck EventArgs e)
{
string qEnabled = "";
string indexid = ITEM_IN_ROW_WHO SE_CHECK_JUST_C HANGED.Text;

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

How do I determine ITEM_IN_ROW_WHO SE_CHECK_JUST_C HANGED?

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 2319
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

"sherifffruitfl y" <sh************ *@gmail.comskre v i meddelandet
news:11******** *************@e 3g2000cwe.googl egroups.com...
Hi,

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

private void editBbListView_ ItemCheck(objec t sender,
System.Windows. Forms.ItemCheck EventArgs e)
{
string qEnabled = "";
string indexid = ITEM_IN_ROW_WHO SE_CHECK_JUST_C HANGED.Text;

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

How do I determine ITEM_IN_ROW_WHO SE_CHECK_JUST_C HANGED?

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.ItemCh eck event:
theListView.Ite ms[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.ItemCh ecked event:
just use: e.Item.

Thi
http://thith.blogspot.com
sherifffruitfly wrote:
How do I determine ITEM_IN_ROW_WHO SE_CHECK_JUST_C HANGED?
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
410
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 event that has occurred because of a mouse click on a Checkbox, and one that has occurred because the .Checked property of an item has been changed programatically? More details if needed, but if you can answer the above, you'll have solved the...
4
1887
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. Let's assume I have two items in the list. The weird part comes when I hold down the control key and select (not check) the items one at a time. When I select the first one it works fine. However, when I select the second one it does become...
4
5398
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 double-clicked. Is this possible? Thanks! Bright
3
5387
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 event? Boris
0
1136
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. This should be extraordinarily simple. I am using Private Sub lvSites_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) Handles lvSites.ItemCheck Me.lvSites.Items(e.Index).Selected = Not CBool(e.CurrentValue =
0
1052
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 remove one of it's previous siblings in the ItemCheck Event, the item does not display as checked. Once I call refresh() it displays fine. Is there some event that gets called after ItemCheck that I can
2
6633
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 item is "processed". When the item becomes processed, i set the listviewitem.checked property to true. To prevent the user from changing the state of the box manually, i use the itemcheck event and set:
4
2669
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 I need to get the text AZ) and search through an array for matching text. When matching text is found I need to populate another listview with some information. So if the array is two-dimensional and I'm looking at elements (0,0 ... 0,7) for...
6
1587
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 Sub I had created needs such value for inserting data in MySQL. My Sub is called: InsertSelItem(ByVal SelItem As Integer)
0
8969
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
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...
0
9335
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9208
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
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
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...
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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.