Module1.vb

 
' *******************************************************************************
' *                                 Introduction                                *
' *                                   --------                                  *
' * This is an example of how you can use a console to gather information       *
' *  and then output that information in a way suited to you.                   *
' *                                                                             *
' *                         Who Should Use This Tutorial?                       *
' *                             --------------------                            *
' * This project should only be used for those new to VB.NET that have          *
' *  some QBASIC experience. If you have VB experience on top of that then      *
' *   you are in good shape and should pick up quickly.                         *
' *                                                                             *
' *                           QBASIC vs. VB.NET                                 *
' *                          --------------------                               *
' * There are several references to QBASIC statements included in this          *
' *  project. If you have no QBASIC experience then just ignore them.           *
' *                                                                             *
' *                             REFERENCE LIST                                  *
' *                                                                             *
' *      QBASIC STATEMENT      VB.NET STATEMENT        EXAMPLE                  *
' *          ---------           ----------             -----                   *
' *           GOSUB   <--------->   Call           Sub Main, Call Main          *
' *           INPUT   <--------->  ReadLine       strA = Console.Readline       *
' *           PRINT   <--------->  WriteLine      Console.WriteLine("Hi")       *
' *                                                                             *
' *                             More Information:                               *
' *                                 ---------                                   *
' *        ReadLine - Unlike a INPUT statement ReadLine does not support        *
' *                   a question before the variable is set.                    *
' *  (QBASIC Exp. INPUT "Please...", strName$)                                  *
' *  (VB.NET Exp. Console.WriteLine ("Please...") _ strName = Console.ReadLine) *                    *
' *                                                                             *
' *        WriteLine & Write - Unlike a PRINT there are two statements in VB    *
' *                            that give you the same power as PRINT. WriteLine *
' *                            allows you to 'fill' an entire line on the       *
' *                            console whereas Write only 'fills' the specified *
' *                            data with that amount in alphanumeric data.      *
' *                                                                             *
' *                            Practice Make Perfect                            *
' *                              ---------------                                *
' * The best thing you can do is to 'play' around with the below code. Change   *
' *  the ReadLine statements to Read statements and the WriteLine statements to *
' *   Write statements. Feel free to add any extra code to this tutorial. The   *
' *    more you fail the more you will learn. If you need any extra help try    *
' *     searching Google or Yahoo with the keyword, "VB.Net Tutorials". Any     *
' *      experience with VB.Net code will help you in the long run.             *
' *                                             Good-Luck                       *
' *         Tutorial Written By: Ryan Miller (Student at TSTC-Waco)             *
' *******************************************************************************

Imports System
Imports System.Collections
Module Module1

    Sub Main()



        Call Headings() ' GoSub Headings



        Call InputData() ' GoSub InputData

        ' Loop until input = "EXIT"

        Do Until UCase$(Console.ReadLine) = UCase$("Exit")
            Call InputData()
        Loop
    End Sub

    Sub Headings()
        ' Write the headings

        Console.WriteLine() ' Writeline is used just a PRINT statement
        Console.WriteLine("                               An example")
        Console.WriteLine("                                   of QBasic")
        Console.WriteLine("                                to VB.Net")
        Console.WriteLine("    ------------------------------------------------------------------------")
        Console.WriteLine()
    End Sub

    Sub InputData()

        ' Here are the variables we will be needing

        Dim strFirstName As String
        Dim strLastName As String
        Dim intAge As Integer

        ' Begin to gather our information

        Console.WriteLine()
        Console.Write("Please enter your first name : ")
        strFirstName = Console.ReadLine ' Readline is used just as a INPUT statement
        Console.WriteLine()
        Console.Write("Please enter your last name: ")
        strLastName = Console.ReadLine
        Console.WriteLine()
        Console.Write("Please enter you age: ")
        intAge = Console.ReadLine
        Console.WriteLine()
        ' Now that we have all of out information lets send it for processing

        Call PrintSummary(strFirstName, strLastName, intAge) ' GoSub PrintSummary
    End Sub

    Sub PrintSummary(ByVal strFirstName As String, ByVal strLastName As String, ByVal intAge As Integer)
        ' Gathers all information from our variables from the InputData Sub
        Console.WriteLine("Your full name is : " & strFirstName & " " & strLastName & " " & "and are " & intAge & " years old.")
        Console.WriteLine()

        Call Endline() ' GoSub Endline
    End Sub

    Sub Endline()
        ' Should we exit the program or continue
        Console.Write("Please enter 'exit' to exit the program or 'next' to resume: ")
    End Sub
End Module

Project Homepage: