Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Last active May 13, 2019 18:46
Show Gist options
  • Select an option

  • Save luisenriquecorona/3b509a80be67722ce8f5aefbb6fdb33f to your computer and use it in GitHub Desktop.

Select an option

Save luisenriquecorona/3b509a80be67722ce8f5aefbb6fdb33f to your computer and use it in GitHub Desktop.
Visual BASIC 2005
Imports System
Namespace
Apress.VisualBasicRecipes.Chapter01
Public Class ConsoleUtils
' This method will display a prompt and read a response from the console.
Public Shared Function ReadString(ByVal message As String) As String
Console.Write(message)
Return Console.ReadLine
End Function
' This method will display a message on the console.
Public Shared Sub WriteString(ByVal message As String)
Console.WriteLine(message)
End Sub
' This method is used for testing ConsoleUtils methods.
' While it is not good practice to have multiple Main methods in an assembly, it sometimes can't be avoided.
' You specify in the compiler which Main subroutine should
' be used as the entry point. For this example, this Main routine will never be executed.
Public Shared Sub Main()
' Prompt the reader to enter a name.
Dim name As String = ReadString("Please enter a name: ")
' Welcome the reader to Visual Basic 2005 Recipes.
WriteString("Welcome to Visual Basic 2005 Recipes, " & name)
End Sub
End Class
End Namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment