Before proceeding, do read Visual Basic Programming for Beginners: Introduction (01)
Well, in the previous blog we have gone through how to get things ready to learn Visual Basic and why we should learn VB and its importance in today's world.
Now we will start working on visual studio and will try to get familiar with it's interface and will build our first VB program.
Step 1:
Open visual studio 2013 on your desktop
Step 2:
Click on File ->New ->Project
Step 3:
Under Templates, Select Visual Basic and then Console Application
Step 4:
Name your project and click "Ok"
Will now have a window like this:
Sub Main()
End Sub
End Module
Well, in the previous blog we have gone through how to get things ready to learn Visual Basic and why we should learn VB and its importance in today's world.
Now we will start working on visual studio and will try to get familiar with it's interface and will build our first VB program.
Step 1:
Open visual studio 2013 on your desktop
Step 2:
Click on File ->New ->Project
Step 3:
Under Templates, Select Visual Basic and then Console Application
Step 4:
Name your project and click "Ok"
Will now have a window like this:
Now in the code editor window, you will have default code like this:
Module Module1
End Sub
End Module
where
Module Module1
is your main container of code and Sub Main()
is a sub procedureRemember that in VB
- Single line of code means single statement unlike C,C++,C# etc where you end with a semicolon(;)
- Each module or a procedure is end with
END
Keyword as you can see in above code.
Our purpose is just to Print A line of string On Console String on Console Window.
Module Module1
Sub Main()
Console.WriteLine("Hello World")
Console.ReadLine()
End Sub
End Module
In the Above Example
Console
is a class in WriteLine()
and ReadLine()
are member functions of this class used to write and read from consloe input.
This was pretty good.
Now Press "START" button to start running your application.
Your output Will be Like this:
In the above code, the work of
Console.WriteLine("Hello World")
was to print "Hello World" On console screen and the work of Console.Readline()
Is same as that that of getch()
in C that is to hold the output screen until a character is enterd.
So,today we have made our first VB program and learned a basic about it.
Till next post get yourself familiar with Visual Studio Environment and Do goggle about
- Solution Explorer
- Open new project in visual studio
- Open Existing Project in Visual Studio
- Properties bar
- Error List in Visual Studio
No comments:
Post a Comment