ListView Checkbox Problem?

joshuaand

Freshman
Joined
Sep 2, 2003
Messages
45
Location
Australia
Hi,

Ok I am porting an application to VB.NET from VB6, and have come across a weird problem I cant seem to solve, I think I have been staring at it for too long so any help is appreciated.

Here is the scenario:

I have a listview, with checkboxes, and I want the user when they click the TEXT, the appropriate checkbox selects, when they click it again, it unselects etc. When you click the checkbox normal operation occurs.

This was easy in VB6, this is what I did:

Code:
Private Sub Contestants_Click()
    If Contestants.SelectedItem.Checked = True Then
        Contestants.SelectedItem.Checked = False
    Else
        Contestants.SelectedItem.Checked = True
    End If
End Sub

Private Sub contestants_ItemCheck(ByVal Item As MSComctlLib.ListItem)
    Contestants.SelectedItem = Item
    If Contestants.SelectedItem.Checked = True Then
        Contestants.SelectedItem.Checked = False
    Else
        Contestants.SelectedItem.Checked = True
    End If
End Sub

Ok now my problem is that I cant do this under .NET, it gets all messed up.

When I apply similar coding in VB.NET is doesnt work, anyone got any suggestions??

Thankyou
Joshua
 
You may have more sucess using the native .Net ListView control rather than goig through interop to the VB6 COM control.
Is this a result of usig the migration wizard?
 
Back
Top