Home All Groups Group Topic Archive Search About
Author
18 Oct 2006 2:19 PM
samoore33
I am working with a program that utilized the checkbox property of a
listview. When a user clicked on the checkbox, it was suppose to
calculate and total some prices. I did not make any changes to the
listview, but now the method does not work when the checkbox is
clicked.

In trying to fix this problem, it would seem that when I click on the
checkbox it calls the itemcheck event. In the itemcheck event I check
to see if the state of the checkbox is True or False. I believe that it
only reads the checkbox as being checked, not as being populated with a
checkmark.

When I step through the method, after clicking a checkbox, it still
shows it false. If I click it again and step through the method it
shows it as true. Also if there is more then one item in the listview,
If one of the items is clicked, it shows the state of the checkbox as
false. If both of the items are clicked then it shows the state of the
checkbox as true.

If anyone has run into the problem before, I would appreciate any help.


If have not been clear enough with my problem, please let me know.

Appreciate any help.

Scott Moore

Author
19 Oct 2006 1:28 AM
maligui
This happens when you use the checkbox, I would use the click event.

    Private Sub CheckBox1_Click(ByVal sender As Object, ByVal e As
    System.EventArgs) Handles CheckBox1.Click
        Select Case Me.CheckBox1.Checked
            Case True
                'Do something
            Case False
                'Do something else
        End Select
    End Sub
Author
19 Oct 2006 1:55 PM
samoore33
The CheckBox in a ListView does not have a click event. It has an
ItemCheck event that I was able to use. A colleague at my work found a
link on MSDN that helped me greatly. I have posted it below in the case
someone else needs help with this situation. I do not want anyone else
to go through fun and enjoyment that is a ListView CheckBox like I did.


http://msdn2.microsoft.com/en-us/library/system.windows.forms.listview.checkeditems.aspx

Scott

mali***@verizon.net wrote:
Show quoteHide quote
> This happens when you use the checkbox, I would use the click event.
>
>     Private Sub CheckBox1_Click(ByVal sender As Object, ByVal e As
>     System.EventArgs) Handles CheckBox1.Click
>         Select Case Me.CheckBox1.Checked
>             Case True
>                 'Do something
>             Case False
>                 'Do something else
>         End Select
>     End Sub