Last active
May 13, 2019 18:46
-
-
Save luisenriquecorona/3b509a80be67722ce8f5aefbb6fdb33f to your computer and use it in GitHub Desktop.
Visual BASIC 2005
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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