Click here to Skip to main content
15,887,812 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to convert this on vb.net?

VB
Private Sub cbouser_Click()

chkall.Value = Unchecked
lvforms.Enabled = True
Dim tmp
Dim rs_check As New ADODB.Recordset
Dim check As String
Dim i
Dim X
    For X = 1 To lvforms.ListItems.Count
        lvforms.ListItems(X).Checked = False
    Next
        
tmp = Split(cbouser.Text, "/")

check = "select accessid,forms as checkform from userform_tab where accessid='" & (tmp(0)) & "'"
rs_check.Open check, conn

    Do While Not rs_check.EOF
        For i = 1 To lvforms.ListItems.Count
        If StrComp(lvforms.ListItems(i).SubItems(1), rs_check!checkform) = 0 Then
            lvforms.ListItems(i).Checked = True
        End If
        Next
    rs_check.MoveNext
    Loop
End Sub
Posted
Updated 13-Oct-13 10:26am
v2
Comments
Bernhard Hiller 14-Oct-13 2:27am    
Some older versions of Visual Studio could convert VB6 projects.

Hi try something like this,

VB
CheckBox1.Checked = False
ListView1.Enabled = True
Dim tmp

Dim check As String
Dim i
Dim X
For X = 1 To ListView1.Items.Count
    ListView1.Items(X).Checked = False
Next

tmp = cbouser.Text.Split("/")

check = "select accessid,forms as checkform from userform_tab where accessid='" & (tmp(0)) & "'"
Dim rs_check As New System.Data.SqlClient.SqlConnection("your Connection string")
rs_check.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand(check, rs_check)
Dim reader As System.Data.SqlClient.SqlDataReader
reader = cmd.ExecuteReader()
If reader.HasRows Then
    While reader.Read()
        For i = 1 To ListView1.Items.Count
            If ListView1.Items(i).SubItems(1).ToString().Compare("your Comapre String1", "your Comapre String2") = 0 Then
                ListView1.Items(i).Checked = True
            End If
        Next
    End While
End If


use OleDbConnection,OleDbCommand,OleDbDataReader if you need Access database

regards
sarva
 
Share this answer
 
v2
You can't convert 100%, you have to do some/more manual changes. Check this
.NET Code Conversion - Convert your code[^]
 
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