Click here to Skip to main content
13,298,451 members (50,802 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I need help. Can somebody help me please?
I'm really wondering why my code always return false even though the datagrid checkbox is checked. Maybe you can help me? Thanks!!
Here's my code.

Dim hasItem As Boolean
        For iCnt = 0 To dgAllow.RowCount - 1
            If dgAllow.Item(1, iCnt).Value = True Then
                hasItem = True
                Exit For
            End If
Posted 1-Jan-13 15:29pm
If is System.Windows.Forms? Then tag: "Forms".
prashant patil 4987 1-Jan-13 23:27pm
@Janna: try to clear your question first..

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

How knows what you do? Anyway, not checking is any check box is checked or not.

Who known what is dgAllow.Item? It item's Value is Boolean, the check looks… well, strange, because you don't need to compare any Boolean with true, as it is already Boolean, you should write If dgAllow.Item(1, iCnt).Value Then

And, it this is, by a coincidence, a check box, this is the real way to test if it is checked:[^].

Happy New Year!


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171207.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100