Home All Groups Group Topic Archive Search About

listview itemcheck event problem

Author
9 Aug 2006 2:04 PM
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.

Author
10 Aug 2006 4:09 PM
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

<ian.watk***@vscsolutions.com> wrote in message
Show quoteHide quote
news:1155132298.887931.126170@b28g2000cwb.googlegroups.com...
> 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.
>
Author
15 Aug 2006 11:08 AM
vsciw
Thanks Claes.

That worked.

Ian.

Claes Bergefall wrote:
Show quoteHide quote
> 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
>
> <ian.watk***@vscsolutions.com> wrote in message
> news:1155132298.887931.126170@b28g2000cwb.googlegroups.com...
> > 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.
> >