Next Page



Visual Studio.Net and Hello World Console Application

If you are new to VB.Net School
This is the 2nd lesson in the VB.Net school. The VB.Net School is a kind of interactive learning platform where those who want to learn .Net with VB.Net can find help and support with a lesson a week, which describes some areas of the VB.Net Programming Language within the Microsoft .Net Platform. This is not a traditional passive tutorial where the author only writes and the reader only reads. There will be exercise problems at the end of each lesson, which you as the reader and student are supposed to solve after reading the lesson. The solutions to the exercises will be provided in the next lesson for you to reflect upon. There is also a dedicated message board coupled with the school where you can ask any questions relating to the lessons. The author will respond to your question within 2/3 days.

For previous lesson click here.

Visual Studio.Net & Its Common Features


Microsoft Visual Studio.Net is an Integrated Development Environment (IDE) which is a successor of Visual Studio 6. It eases the development process of .Net Applications by a great deal for VC#.Net, VB.Net, VC++.Net, JScript.Net, J#.Net, ASP.Net, etc. The revolutionary approach in this new Visual Studio.Net is that for all the Visual Studio.Net Compliant Languages there is the same IDE, debugger, project and solution explorer, class view, properties tab, tool box, standard menu and toolbars. The key features of Visual Studio.Net include:


  1. Keyword and syntax highlighting
  2. Intellisense (autocomplete), which helps by automatically completing the syntax as you type a dot (.) with objects, enumerations, namespaces and when you use the new keyword.
  3. Project and solution management with solution explorer that helps to manage applications consisting of multiple files, which is what usually happens.
  4. Help building user interface with simple drag and drop over form window.
  5. Properties tab that allow you to set different properties on a number of windows and web controls.
  6. Standard debugger that allows you to debug your program by putting break points for observing run-time behavior of program.
  7. Hot compiler that checks the syntax of your code as you type it and reports any errors present.
  8. Dynamic Help on a number of topics using the Microsoft Development Network (MSDN) library.
  9. Compilating and building applications.
  10. Execution of your application with/without the debugger.
  11. Deploying your .Net application over the Internet or on CDs.
Project and Solutions
A Project is a combination of executable and library files that make an application or module. A project's information is usually placed in a file with the extention '.vbproj' where 'vb' represents Visual Basic. Similarly, C#.Net projects are stored as '.csproj' files. There are several different kinds of projects such as Console Applications, Windows Applications, ASP.Net Web Applications, Class Libraries and more.

A solution on the other hand is a placeholder for different logically related projects that make some application. For example, a solution may consist of an ASP.Net Web Application project and a Windows Form project. The information for a solution is stored in '.sln' files and can be managed using Visual Studio.Net's Solution Explorer. Solutions are similar to VB 6's Project Group and VC++ 6's workspace.

Toolbox, Properties and Class View Tabs


Now there is a single toolbox for all the Visual Studio.Net's languages and tools. The toolbox (usually present on the left hand side) contains a number of common controls for windows, web and data applications like the text box, check box, tree view, list box, menus, file open dialog, etc.

The Properties Tab (usually present on the right hand side in the IDE) allows you to set the properties on controls and forms without getting into code.

The Class View Tab shows all the classes that your project contains along with the methods and fields in tree hierarchy. This is similar to VC++ 6's class view.

Author's Note:It is not necessary at all that you use Visual Studio.Net to build your .net applications. You can write your code in any text editor like notepad and then compile and run it from command prompt (which we will see shortly). But Visual Studio.Net takes a lot of these responsibilities and smoothes the development process a lot, which allows you to spend more time in your business logic rather than these compiling and building hacks.

Writing Your First "Hello World" Console Application in VB.Net
As follows, we will build our first VB.Net application without and then with Visual Studio.Net. Instructions below show, how to write, compile, and execute a VB.Net application. An explanation of the different concepts in the program will follow later in the chapter.

Without Visual Studio.Net
Open "Notepad" or a text editor of your choice and type the following code:

Imports System
Module Module1
    Sub Main()
        Console.WriteLine("Hello World!")
    End Sub
End Module


Save this with any file name with the extension ".vb" (for example, 'MyFirstApplication.vb'). To compile the program, go to command prompt and type:

vbc MyFirstApplication.vb


This will compile your program and create an .exe file (MyFirstApplication.exe) in the same directory. Errors will be reported if there are any. To run your program, type:

MyFirstApplication


This action will print "Hello World!" on the console screen. Simple, isn't it? Let's try it in the Visual Studio.Net IDE


School Home

 

Other Views

corner

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.