Saturday, 14 March 2015

Visual Basic Programming for Beginners: Getting Started (02)

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:

Now in the code editor window, you will have default code like this:

Module Module1

Sub Main()

End Sub

End Module

The above is your default VB code which must be there to start with.
Module Module1 is your main container of code and
Sub Main() is a sub procedure

Remember 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. 
Now, Hello World Program in VB

Our purpose is just to Print A line of string On Console String on Console Window.

Module Module1
Sub Main()
Console.WriteLine("Hello World")
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
Till then keep practicing and coding in Visual Basic 

[How to] Connect an android device [using MTP] on Linux [Ubuntu 14.04 LTS] 100% working

I recently moved to Linux[Ubuntu 14.04 ] from windows 8.1 because it hangs a lot on my lappy. Apart from the cool features of Ubuntu , one...