Module Module1
Sub Main()
'show banner
DisplayBanner()
'Get user's name and say howdy
GreetUser()
End Sub
Sub DisplayBanner()
'Get the current color of the console text
Dim currColor As ConsoleColor = Console.ForegroundColor
'set text color to yellow
Console.ForegroundColor = ConsoleColor.Yellow
Console.WriteLine("***** Welcome to FunWithModules *****")
Console.WriteLine("This simple program illustrates the role")
Console.WriteLine("of the Module type.")
Console.WriteLine("**********************************")
'reset the previous color of your console text.
Console.ForegroundColor = currColor
Console.WriteLine()
End Sub
Sub GreetUser()
Dim userName As String
Console.Write("Please enter your name: ")
userName = Console.ReadLine()
Console.WriteLine("Hello there {0}. Nice to meet ya.", userName)
End Sub
End Module
Public Class Program
Shared Function Main(ByVal args As String()) As Integer
'OS running this app?
Console.WriteLine("Current OS: {0}", Environment.OSVersion)
'List the drives on this machine.
Dim drives As String() = Environment.GetLogicalDrives()
Dim d As String
For Each d In drives
Console.WriteLine("You have a drive named {0}.", d)
Next
'Which version of the .NET platform is running this app?
Console.WriteLine("Executing version of .NET: {0}", Environment.Version)
Return 0
End Function
End Class
Module Module1
Sub Main()
Console.WriteLine("***** Fun With Data Types *****")
Console.WriteLine("Max of Integer: {0}", Integer.MaxValue)
Console.WriteLine("Min of Integer: {0}", Integer.MinValue)
Console.WriteLine("Max of Double: {0}", Double.MaxValue)
Console.WriteLine("Min of Double: {0}", Double.MinValue)
Console.WriteLine("Boolean.FalseString: {0}", Boolean.FalseString)
Console.WriteLine("Boolean.TrueString: {0}", Boolean.TrueString)
Console.ReadLine()
End Sub
End Module
No comments:
Post a Comment