Is it acceptable to define a “module” and “class” within a single .VB element?
Imports System.Runtime.CompilerServices


Module ExtensionsTest
    <Extension()>
    Public Sub ToConsole(ByVal Ex As Exception)
        Dim ForeColor As ConsoleColor
        Console.ForegroundColor = ConsoleColor.Red
        Console.WriteLine()
        Console.WriteLine("An unhandled exception has occurred!")
        Console.WriteLine(Ex.ToString)
        Console.ForegroundColor = ForeColor
    End Sub
End Module


Class Test
    Public Sub Test()
        Try
            Dim test As New Object
            test.SomeMethodDoesntExist()
        Catch ex As Exception
            ex.ToConsole()
        End Try
    End Sub
End Class
July 28th, 2015 8:08am

Hi Sir,

This forum is talking about MS Visio that a part of MS office, not Visual Studio, please post the question to VS forum:

https://social.msdn.microsoft.com/Forums/en-US/home?category=vslanguages

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

Regards,

George Zhao
TechNet Community Support

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 1:13am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics