Vb.Net

Only available on StudyMode
  • Topic: Data types, C, Data type
  • Pages : 46 (6449 words )
  • Download(s) : 61
  • Published : January 25, 2011
Open Document
Text Preview
CHAPTER 2

Introduction to VB.NET VB.NET

Visual Basic .NET is the next version of the very famous Visual Basic programming language. Visual Basic .NET offers developers with the benefits of rapid development with a full-support of object-oriented (OO) programming concepts. Visual Basic .NET provides the easiest, most productive language and tool for rapidly building Windows and Web applications. Visual Basic .NET comes with enhanced visual designers, increased application performance, and a powerful integrated development environment (IDE).

Problems with Visual Basic

The following are the major problems with Visual Basic 6.0
• No capabilities for multithreading.
• Lack of implementation inheritance and other object oriented features. • Poor error handling capabilities.
• Poor integration with other languages such as C++.
• No effective user interface for Internet based applications.

Key features of the Visual Basic .NET programming language include the following:

• Full support for Object-Oriented Programming
• Powerful Windows-based Applications
• Building Web-based Applications
• Access to .NET Framework.
• Powerful unified Integrated Development Environment (IDE). • Simplified Deployment
• Powerful, Flexible, Simplified Data Access
• XML Web Services
• Mobile Applications
• New Console capabilities of VB.NET.
• Interoperability with other .NET enabled languages.
• Enhanced event handling
• Parameterized properties
• Redeclaration of interface members on implementation

Console Applications in VB.NET

Console Applications are command line based and run in within a DOS Shell (DOS Window). Console Applications are command-line oriented applications that allow us to read characters from the console write characters to the console and are executed in the DOS version. Unlike Windows Applications, Console Applications do not support Windows GUI's. Which means that you can’t work with controls from the toolbox?

To create Console Applications select File->New->Project and in selected "Console Application" from the template under Visual Basic Hello World Example
The following is a very simple VB.NET program, "Hello world" example created as a console application: Open Visual Studio from the Programs menu and click New Project from File Menu, the New Project Window will appear like this

[pic]
Fig: 2.0

Select Console Application, give the file name and select the location to store

Structure of Console Application in VB.NET

Module Module1

Sub Main()
Console.WriteLine("Hello, world!")
End Sub

End Module

The output of the program is Hello, world! . Each line serves a specific purpose, as follows:

Module Module1

This is a module definition. Modules serve as containers of code that can be referenced from other parts of a program. The Module name and name of the file must same.

Sub Main()

This is the starting point where the program begins its execution. Sub is an abbreviation of "subroutine."

Console.WriteLine("Hello, world!")

This line outputs the text Hello, World!. Console is a system object, representing a command-line console where a program can input and output text. The program calls the Console method WriteLine, which causes the string passed to it to be displayed on the console. Another common method is using Message Box. To Run

Run the program by pressing "F5" on the keyboard or by selecting Debug->Start. Compilation of the program using the Visual Studio .NET Command Prompt is also possible. To compile the program using that type "vbc filename.vb" at the command prompt. Data Types

Data Type defines the characteristics of a variable that is it determines what type of value a variable can hold. VB.Net supports different Data Types.

|Data Type |Size in Bytes |Description...
tracking img