Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 4 - Learning VB.NET Through Text Game Developm...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Learning VB.NET Through Text Game Development
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 6
    2008-05-28

    Table of Contents:
  • Learning VB.NET Through Text Game Development
  • The Concept
  • Getting Started
  • Getting Started continued

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Learning VB.NET Through Text Game Development - Getting Started continued


    (Page 4 of 4 )

    So, now that we know what a module is, what's the “sub” thing? It stands for subroutine and is equivalent to a function with a void return type—that is, it returns no value and instead performs some sort of operation with a desirable side effect. The parenthesis, of course, can be filled with parameters, but we'll get to that later. It's part of a broader group of procedures, which includes functions as well. This is why you'll hear this particular procedure be called a Sub procedure.

    This particular procedure, Main, is special. It's what is called when the program executes, so it's the heart of the program. In Visual Studio, press the green arrow in the toolbar, or press F5. This will start debugging, a process we're not interested in right now, but we are interested in running the program, which is what will happen. You may notice a console appear real fast and then disappear. This is our program executing. The console disappears so fast because, of course, our program does nothing at the moment. Let's fix this. Let's print out “Hello World” and then wait for a key to be pressed before exiting:


    Sub Main()

     System.Console.WriteLine("Hello World!")

    System.Console.ReadKey()

     End Sub


    Now start the program up. The program will print “Hello World” in the console and then wait for a key to be pressed before terminating, as expected.

    The above example shows two procedures being called. Nothing is strikingly odd about the two calls—they are done in the same manner as in other languages. What is worth nothing, however, is our use of the Framework Class Library here. In the example, we access the System namespace, which is where the base classes are stored. We can actually omit the namespace here, but I just wanted to point out its existence. The following code is equivalent:


    Sub Main()

     Console.WriteLine("Hello World!")

    Console.ReadKey()

     End Sub


    In the System namespace, we access the Console type. This type provides shared (static) procedures that we can use to control the console, displaying information to the user and reading information from the user. We'll be using this type a lot since our application is console-based.

    Finally, we access the procedures WriteLine and ReadKey. WriteLine does what its name implies: it simply writes a line of text out to the console. ReadKey reads a key press and returns information about the key pressed (which we have no use for and therefore do not store).

    I'm afraid that's all I have room for in this article. Be sure to check back next week though. I'll be picking up where I left off, with more information about WriteLine, and move on to more complex matters. See you then!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Don't know if I just wasn't able to locate the main content of this article as I'm...
       · There's definitely more steps involved. ;-)This article is part of a series of...
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT