Thursday 27 June 2013

Writing first program in VB.NET

First application will be named

HelloWorld


HelloWorld :-
1.  Open Visual Basic IDE. 


2.  Click File then-> New Project (Ctrl + N) and Select Windows Forms Application

3.  In Name box, write: HelloWorld. Use Browse button to select folder location for this
Application and press OK.  

4.  A new application will be created and Form will appear. Drag and drop the button from the
toolbox on the form. 

ToolBox :- 



5.  Select the form and change Text property of the button to HWGUI.

6.  Select the button and change Text property of the button to Click Me.  Double click the button
to open code page and Add the following line.
          MsgBox("Hello World")

7.  To run the code, press F5 or go to Debug > Start Debugging 

8.  In run mode, Press the button of Click Me  . A popup will appear displaying the message Hello
World

Hello worls Application Look



9.  You can run this application by clicking the exe file from
..\HelloWorld\HelloWorld\bin\Debug folder




CREATING AND USING VARIABLES IN VISUAL BASIC.NET

A Variable is Declared In following format in visual basic.NET :-

Dim variable-name As Datatype

where Dim is a keyword Used For Creating Variable in Visual Basic.
* Variable-name is Name of variable 
* As is a Keywork used to Define Datatype of variable after it
* Datatype is Type of Data That the Data is going to Accept

EXAMPLE 1 :-

Dim msg as string 
msg = "Hello How Are You"
Msgbox(msg)

This code will message "Hello How Are You" With Default Ok Button


EXAMPLE 2 :-



Dim msg as string 

Dim msg1 as string
msg = "Hello How"
msg1= "Are You"
Msgbox(msg + msg1)

This code will message "Hello How Are You" With Default Ok Button

Share this

0 Comment to "Writing first program in VB.NET"

Post a Comment