Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 3 - 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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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


    (Page 3 of 4 )

    Now that you know the basics of the .NET Framework and understand where we're going, let's get started with Visual Basic. Open up Visual Studio and create a new project. Call it whatever you want, but make sure that you use the Console Application template—our game is, of course, console-based. The project will automatically open. The Console Application template creates a minimal project. Only one file, Module1.vb is created for you. This is where we'll start. The file's contents look something like this:


    Module Module1


     Sub Main()


     End Sub


    End Module



    Since Visual Basic, naturally, features a BASIC-style syntax, instead of using brackets as one would expect in a C-style language, plain words are used. Here, you can easily see that we have something called a “sub” inside of something called a “module.” The “module” begins with the keyword Module and ends with the keywords End Module. Similarly, the “sub” begins with the keyword Sub and ends with the keywords End Sub. That, of course, prompts the question, what exactly are subs and modules?

    We'll start with the module. A module is akin to a static class in other languages, and it's what is used by default to contain the main “method” (we can't really use that language here, but we'll get to that in a few paragraphs) of a Visual Basic application. Everything is shared (“static” in other languages, meaning that the member is not specific to an instance of the class but, instead, belongs to the class itself) and is, by default, public. This is important to remember! Again, Visual Basic starts us off with a module in which to create our program, but we can create more modules in our program if we need to, and we could also wrap our program in a class, as is done in C#:


    Public Class Class1


     Public Shared Sub Main()


     End Sub


    End Class


    This should look more familiar to many people, with the exception of the word “shared,” which was covered earlier. This will compile and has the potential to produce the same effect as with the module. (Note that in Visual Studio you must first go to Project->Properties and change the startup object.) This code snippet also demonstrates how classes are defined in Visual Basic.

    Just because we can, however, doesn't mean that we should. Modules are infinitely more “VB-ish” and are what we're going to use here. The module of a new project is by default called Module1 and is contained within a file called Module1.vb. We can change this, however, to reflect the nature of our project. Change the filename to Game.vb. In Visual Studio, this will automatically change the module's name to Game (neat!):


    Module Game


     Sub Main()


     End Sub


    End Module

    More Visual Basic.NET Articles
    More By Peyton McCullough


       · 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

    - 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...
    - Creating and Drawing a Game Map in VB.NET (F...
    - Working with Classes and Properties for Game...
    - Working with Loops, Arrays, and Collections ...
    - Learning Loops in VB.NET for Game Development
    - Learning VB.NET: Working with Variables, Con...
    - The Basics of VB.NET Through Text Game Devel...
    - Learning VB.NET Through Text Game Development
    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




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