borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2012 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Generate barcode in C#) New Topic New Poll Post Reply
AndreaVB Forum : C# : VB6 to C# convert coding
Poster Message
VYX
Level: Professor


Registered: 16-12-2005
Posts: 78

icon VB6 to C# convert coding

Guys..

I have this kind of coding techniques in VB6 and i want this to convert into C# and VB.net.

I created a module for connectionn something like this


Public Function CONNECT(ByRef cn As ADODB.Connection, ByRef rs As ADODB.Recordset, ByRef sql As Variant) As Boolean

On Error GoTo errs
cn.Open vConnectionString'=sql connectionstring

    With rs
        .CursorLocation = adUseClient
        .Open sql, cn, adOpenKeyset, adLockOptimistic
    End With
    CONNECT = True
    Exit Function
'End If
Exit Function
End Function

Public Sub disconnect(ByRef cn As ADODB.Connection, ByRef rs As ADODB.Recordset)
Set cn = Nothing
Set rs = Nothing
End Sub


then at form if i am going to populate a list view

i created like this


Public Sub ListAllORCollected()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim vsql As String

LVIEW.ListItems.Clear
vsql = "select idno,trdate,fullname,totalreceived from tblINFO"

With LVIEW
   '.Visible = False
   .Checkboxes = False
   .FullRowSelect = True
   Set .SmallIcons = ImageList1


CONNECT cn, rs, vsql
With rs
If .RecordCount > 0 Then
    .MoveFirst
    Do While Not .EOF
        Set X = LVIEW.ListItems.Add(, , UCase(!idno)) '        On Error Resume Next
        X.SubItems(1) = UCase(!TRDate)
        X.SubItems(2) = UCase(Trim(!FullName))
        X.SubItems(3) = FormatNumber(!totalreceived, 2, vbTrue) ''amount
      
                
    .MoveNext
    Loop
    
End If
End With
End With
disconnect cn, rs

End Sub

Could anyone help me out how to workout on this..
Thanks in advance.. All your help suggestions and idea about this, really appreciated,

Thank you

14-08-2012 at 12:45 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : C# : VB6 to C# convert coding
Next Topic (Generate barcode in C#) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2012 Andrea Tincaniborder