3/1/12

An introduction to using Visual Basic 2010

Visual basic is an IDE that allows you to make a GUI and then make it do what you want writing code in a language called visual basic. Visual Basic has many useful tools such as the ability to add components from already existing software to help on syntax errors. There are many useful forums for support on using Visual basic 2010 so you will not feel alone if you come across a problem you cannot solve. The language itself is not to complicated and is an ideal place to start if your a young/new programmer looking to make simple to complex software and applications. 



Many useful tools such as predictive coding where if you type in a component then "." it will tell you all the options you can have for the component to does an action.

Here an example:


Visual basic also comes with many pre-made and components to help you along the way for example: the code to have an icon for your software, pre-made splash screen (start up screen), a pre installed debugger and finally it creates an installation application for your software so you don't have to. But this is just to name a few. you can download visual basic 2010 from here just follow the instructions provided.The next thing we will talk about is making your first application, so first open up visual basic until you get a screen like this: 
Then click File, New project, Windows for application. Name the application "hello world" then click ok. after that the screen should have loaded to something like this: 
his screen is showing you the GUI of your first application first of all we are going to make things simple. Click on "form1>properties>text" change the text "hello world". You should have notice the text on your form change to the text you just typed in if so click on the toolbox item located in the far left of the screen in the dark blue margin a small box should open like this: 
This toolbox shows you all the components you can put into your application, the ones showing now are just the pre set ones but you can download custom ones from the internet to enhance your component library. Now click on the "button" component and drag and drop into onto your form, then change the text of the button using the same method we used to change the text of the form to "&Go" the "&" sign puts a little underscore under the first letter of the word your form should then look like this: 
Once you have this double click on the button and the coding screen should show up like this:
The "private sub.." just means then when the button is pressed it will do what your just about to type in using the visual basic language, And the end sub ends the event of what you'll be telling the button to do and finally the "end class" indicates there is no more script for the application to read. Ok now what we want our button to do is when clicked to show a second form that will say "HELLO WORLD" and to do this you need to use this code: 
Once you have that written down go to File>Save all> "select destination"> save. Then click Build>Build hello world, this will then build your application once the build has finished you will need to make sure it works outside of the IDE and to do this you open up the directory of where you saved your project to then click on the hello world folder>bin>release> "hello world.exe". this will load your first application and when you click "&Go" you message box will show up like so: 
Well done if all has gone to plan you first ever application made in visual basic has been made. I will be posting more tutorials getting progressively more complex soon so stay tuned. if you come across any problems please contact me

SHARE THIS POST:

2 comments:

  1. @Mohsen Karimi Visual Basic (VB) is a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. check wikipedia..

    ReplyDelete