Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim x As Integer
       Dim x1 As Integer
       Dim check As String = "select accessid from userform_tab where accessid = '" & cboposition.Text & "'"
       Dim ctr As Integer

       CLSCONN = New C_connection
       CLSCONN.ACCESS_INDREC(check)

       For x = 1 To lvsettings.Items.Count
           lvsettings.Items(x).Checked = False  ==> I always encountered an error here saying , "Argument Out of Ranged was unhandled"
"Invalid Argument  = Value of '12' is not a valid for 'index'"
"parameter name:index"
       Next

       With CLSCONN.ds
           For ctr = 0 To .Tables(0).Rows.Count - 1
               If .Tables(0).Rows(ctr)("extra") = 0 Then
                   For x1 = 0 To lvsettings.Items.Count - 1
                       lvsettings.Items(x1).Checked = True
                   Next
               End If
           Next

       End With
Posted
Updated 13-Oct-13 23:50pm
v2

1 solution

Simple: Arrays run from 0 to count -1
Try:
VB
For x = 0 To lvsettings.Items.Count -1
Instead.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900