listview itemcheck event problem

I

ian.watkins

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:

e.NewValue = e.CurrentValue


This worked fine in VS2003, but now, when i set the checked property to
true, the itemcheck event is being kicked off and sets it back to false
(unchecked).

Can anyone help!
Ian.
 
C

Claes Bergefall

Turn off the event handler before you set the check state and then turn it
on again when you're done. Something like this:

RemoveHandler myListView.ItemCheck, AddressOf myListView_ItemCheck
myListViewItem.Checked = True
AddHandler myListView.ItemCheck, AddressOf myListView_ItemCheck

/claes
 
V

vsciw

Thanks Claes.

That worked.

Ian.

Claes said:
Turn off the event handler before you set the check state and then turn it
on again when you're done. Something like this:

RemoveHandler myListView.ItemCheck, AddressOf myListView_ItemCheck
myListViewItem.Checked = True
AddHandler myListView.ItemCheck, AddressOf myListView_ItemCheck

/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top