We still have an old VBScript app at my work and in an effort to eliminate it and replace it with something .NET we’ve started porting it to VB.NET. I won’t go into why it isn’t being completely rewritten.
Anyway, the app has a host of include files and when I started looking to move this functionality over I found that VB.NET can instantiate what are called Modules. For C# types like myself a Module is basically a static class that exists at the namespace level. It’s kinda awesome and also kinda crazy, because once you declare a function or subroutine in a module it is directly callable from anywhere in that namespace. Meaning, unless you duplicate the function/subroutine name you can just call that function/subroutine without any qualifier.
Public Module myModule
Sub DoSomeStuff()
Dim userName As String = InputBox("What is your name?")
MsgBox("User name is" & userName)
End Sub
' Insert variable, property, procedure, and event declarations.
End Module
Public Class myClass
Public Function Start
DoSomeStuff()
End Function
End Class
I plan to continue to avoid VB.NET as much as possible, as I have for the last ten years since I gave up VB programming, because I find it syntactically verbose compared to C#, but this is still interesting and a nice holdover to allow one to essentially cut and paste a VBScript include into a file in VB.NET and have it work (given certain syntactic differences).
This is also a nice VBScript to VB.NET conversion page.
Update 1/29/2015: Also just to note that Visual Studio 2008 and earlier have tooling that will convert VB code into VB.NET. Later versions do not have this.