C# to vb.net RRS feed

  • Question

  • User-1128333567 posted

    How would following C# code be written in vb.net??


    public static SqlConnection GetConnection()


    string connstr = ConfigurationManager



     return new SqlConnection(connstr);




    Wednesday, October 28, 2009 5:29 PM


  • User77042963 posted
        Public Shared Function GetConnection() As SqlConnection
            Dim connstr As String = ConfigurationManager.ConnectionStrings("NewsletterDB").ConnectionString
            Return New SqlConnection(connstr)
        End Function


    A useful online conversion tool:


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 28, 2009 5:32 PM

All replies