Hello,

I have a ListView control in Details view. When an item is un-checked, I
want to change the ForeColor.

The only way I have found to do this is to loop through all the items of the
ListView in its Click, DoubleClick, and KeyPress events using the sub below
. However, the ListView can potentially hold hundreds of items, so this
would be quite slow.

Is there a better way to handle when an item is checked/un-checked?

Thank you,

Eric

\\\
Private Sub HandleCheckChange()
Dim item As ListViewItem
For Each item In lvwDirectories.Items
If item.Checked Then
item.ForeColor = SystemColors.WindowText
Else
item.ForeColor = SystemColors.GrayText
End If
Next
End Sub
///

Re: Handling ListView Check Changes by Stoitcho

Stoitcho
Wed Aug 11 08:36:06 CDT 2004

What about ListView.ItemCheck event. Didn't it do the trick for you?

--
HTH
Stoitcho Goutsev (100) [C# MVP]


<anonymous@discussions.microsoft.com> wrote in message
news:%23A9Msx5fEHA.1428@TK2MSFTNGP10.phx.gbl...
> Hello,
>
> I have a ListView control in Details view. When an item is un-checked, I
> want to change the ForeColor.
>
> The only way I have found to do this is to loop through all the items of
the
> ListView in its Click, DoubleClick, and KeyPress events using the sub
below
> . However, the ListView can potentially hold hundreds of items, so this
> would be quite slow.
>
> Is there a better way to handle when an item is checked/un-checked?
>
> Thank you,
>
> Eric
>
> \\\
> Private Sub HandleCheckChange()
> Dim item As ListViewItem
> For Each item In lvwDirectories.Items
> If item.Checked Then
> item.ForeColor = SystemColors.WindowText
> Else
> item.ForeColor = SystemColors.GrayText
> End If
> Next
> End Sub
> ///
>
>



Re: Handling ListView Check Changes by anonymous

anonymous
Wed Aug 11 12:42:25 CDT 2004

Oh, brother. I didn't even see the ItemCheck event. Thank you for your
help, Stoitcho.

Please accept my apologies for my ignorance. ;-)

Eric


"Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
news:uTgJaf6fEHA.1972@TK2MSFTNGP09.phx.gbl...
> What about ListView.ItemCheck event. Didn't it do the trick for you?
>
> --
> HTH
> Stoitcho Goutsev (100) [C# MVP]
>
>
> <anonymous@discussions.microsoft.com> wrote in message
> news:%23A9Msx5fEHA.1428@TK2MSFTNGP10.phx.gbl...
> > Hello,
> >
> > I have a ListView control in Details view. When an item is un-checked,
I
> > want to change the ForeColor.
> >
> > The only way I have found to do this is to loop through all the items of
> the
> > ListView in its Click, DoubleClick, and KeyPress events using the sub
> below
> > . However, the ListView can potentially hold hundreds of items, so this
> > would be quite slow.
> >
> > Is there a better way to handle when an item is checked/un-checked?
> >
> > Thank you,
> >
> > Eric
> >
> > \\\
> > Private Sub HandleCheckChange()
> > Dim item As ListViewItem
> > For Each item In lvwDirectories.Items
> > If item.Checked Then
> > item.ForeColor = SystemColors.WindowText
> > Else
> > item.ForeColor = SystemColors.GrayText
> > End If
> > Next
> > End Sub
> > ///
> >
> >
>
>



Re: Handling ListView Check Changes by Sijin

Sijin
Thu Aug 12 06:46:02 CDT 2004

Use ListView.ItemCheck event

--
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph


<anonymous@discussions.microsoft.com> wrote in message
news:%23A9Msx5fEHA.1428@TK2MSFTNGP10.phx.gbl...
> Hello,
>
> I have a ListView control in Details view. When an item is un-checked, I
> want to change the ForeColor.
>
> The only way I have found to do this is to loop through all the items of
the
> ListView in its Click, DoubleClick, and KeyPress events using the sub
below
> . However, the ListView can potentially hold hundreds of items, so this
> would be quite slow.
>
> Is there a better way to handle when an item is checked/un-checked?
>
> Thank you,
>
> Eric
>
> \\\
> Private Sub HandleCheckChange()
> Dim item As ListViewItem
> For Each item In lvwDirectories.Items
> If item.Checked Then
> item.ForeColor = SystemColors.WindowText
> Else
> item.ForeColor = SystemColors.GrayText
> End If
> Next
> End Sub
> ///
>
>