Back to .NET

Joined
Aug 30, 2002
Messages
633
Continuation (sort of) from http://www.hardforum.com/showthread.php?t=804996

Okay, I've had a chance to put more focus back into my previous project. This time off has lead me to believe that my CountItem() function is not working properly. I think it's something to do with the items in a CheckBoxList are not being accessed properly.

The way I have it now, CountItem() is being called on the button click, should I change it to the Page_Load when it's a postback?

Function:
Code:
    Function CountItem(ByVal state As CheckBoxList, ByVal niche As CheckBoxList, ByVal product As CheckBoxList, ByVal flag As CheckBoxList) As Integer
        Dim total As Integer
        Dim item As ListItem
        total = 0
        For Each item In state.Items
            If item.Selected Then
                total = total + 1
            End If
        Next
        For Each item In niche.Items
            If item.Selected Then
                total = total + 1
            End If
        Next
        For Each item In product.Items
            If item.Selected Then
                total = total + 1
            End If
        Next
        For Each item In flag.Items
            If item.Selected Then
                total = total + 1
            End If
        Next
        Return total
    End Function
 
Ok, I got the count working. Just fixing a few bugs. Thanks for those who helped in the other thread :)
 
Back
Top