Click here to Skip to main content
15,867,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here's my code.. And the checked items still disappear after I'm saving it. I want the checked items still visible as possible.

VB
CheckBox1.Checked = False
       lvsettings.Enabled = True
       Dim tmp
       Dim check As String
      
       Dim i
     
       tmp = cboposition.Text.Split("/")

       check = "select accessid,forms as checkform from userform_tab where accessid='" & (tmp(0)) & "'"
     
       Dim rs_check As New Odbc.OdbcConnection("DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;User=root;PWD=sa;Database=kim_lyn_db")
       rs_check.Open()
       Dim cmd As New Odbc.OdbcCommand(check, rs_check)
       Dim reader As Odbc.OdbcDataReader
       reader = cmd.ExecuteReader()
       If reader.HasRows Then
           While reader.Read()

           End While

       End If


       For i = 0 To lvsettings.Items.Count - 1
           
           If String.Compare("rs_check", "user_tab") = 0 Then ==> I think, here is the problem on my codes. Don't you think? Thanks.

               lvsettings.Items(i).Checked = True

           End If

       Next
Posted
Updated 14-Oct-13 21:19pm
v2
Comments
Pascal Ganaye 16-Oct-13 9:54am    
Your question is hard to follow.
You says "How does checked items in listview can still be visible after I'm saving it"
As I see it, nowhere in your code you are removing items from lvsettings.
You are only turning on the check box.

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

  Print Answers RSS


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