Link to home
Start Free TrialLog in
Avatar of Kevin
KevinFlag for United States of America

asked on

Convert VB.Net Code to C#

Good Afternoon,

I need to rewrite an application from VB.Net to C#. I don't know any C# but guess I will learn along the way. i am using a converter (http://converter.telerik.com/) to convert my module but the converter doesn't appear to convert everything.

I've created a class for my functions (since modules are not used in C#) and am having trouble converting the below to C#, can someone help me rewrite it?

Imports Microsoft.Win32

Module modGlobals

    'Global Registry 
    Public gRegKeyName As String = "HKEY_CURRENT_USER\Software\AFA\TOOLEX"

    Public Function gConnString() As String

        'Global Access Database
        Dim DBPath As String
        DBPath = My.Computer.Registry.GetValue(gRegKeyName, "DBPath", "")

        gConnString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & ";Persist Security Info=False;"

        Return gConnString

    End Function

    Public Function gCSVExport() As String

        'Global CSV Export Path
        Dim ExportPath As String
        ExportPath = My.Computer.Registry.GetValue(gRegKeyName, "ExportPath", "")

        Return ExportPath

    End Function

End Module

Open in new window


Also what syntax would I use to call these functions from within my application?

Any help would be most appreciated.

Kind Regards,
N
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kevin

ASKER

Thanks. Looks like I need to hit the books as well to get a better understanding.