Author Topic: Coding for Beginners In VB.NET  (Read 2993 times)

0 Members and 1 Guest are viewing this topic.

Offline Sub5

Coding for Beginners In VB.NET
« on: January 04, 2013, 09:44:27 AM »
Getting Started with Visual Basic .NET is the foundation of effectively learning of the VB, i will be pulling a lot of resources all round to make this very easy to understand. Let get started.
First download and launch your Visual Basic .NET or Visual Studio software,you'll see a screen something like this one, if you have the 2008 version:

Or this one for version 2010:

In the 2012 version, you'll see this:

There's a lot happening on the start page. But basically, this is where you can start a new project, or open an existing one. The first Tab, Projects, is selected. At the moment, the area labelled "Open an Existing Project" is blank. This is what you'll see when you run the software for the first time (because you haven't created a project yet). When you create a project, the Name you gave it will be displayed on this page, as a hyperlink. Clicking the link will open the project.

At the bottom of the screen, there are two buttons: "New Project" and "Open Project". To get started, click the "New Project" button. When you do, you'll see this dialogue box appear in the version 2008:

Or this one for version 2010:

In the 2012 version, you'll see this:

As a beginner, you'll normally want the option selected: "Windows Application", in the "Visual Basic Projects" folder. This means that you're going to be designing a programme to run on a computer running the Microsoft Windows operating system.

If you look in the Name textbox at the bottom, you'll see it says "WindowsApplication1". This is the default name for your projects. It's not a good idea to keep this name. After all, you don't want all of your projects to be called "WindowsApplication1", "WindowsApplication2", etc. So click inside this textbox and change this Name to the following:

My First Project

Keep the Location the same as the default. This is a folder inside of your "My Documents" folder called "Visual Studio Projects". A new folder will then be created for you, and its name will be the one you typed in the "Name" textbox. All of your files for your first project are then saved in this folder.

Click the OK button, and the Visual Basic NET design time environment will open.
Source:home and learn

All Student Forum

Coding for Beginners In VB.NET
« on: January 04, 2013, 09:44:27 AM »

Offline Sub5

Re: Visual Basic .NET Forms(The Default Form)
« Reply #1 on: January 04, 2013, 12:40:31 PM »
In the Visual Basic NET design time environment, the first thing to concentrate on is that strange, big square in the top left. That's called a form. It's actually the pretty bit of your programme, the part that others will see when they launch your masterpiece. Granted, it doesn't look too attractive at the moment, but you'll soon discover ways to lick it into shape.

To run the form, try this:

 From the menu bar, click Debug

From the drop down menu, click Start

Alternatively, press the F5 key on your keyboard

Your programme is launched

Congratulations! You have now created your very first programme. It should look like this:

Click the Red X on the form to stop it from running. You will then be returned to the software environment.

If you look at the bottom of the screen, you'll see an Output Window in Version 2012 of the VB software:

You can get rid of this by clicking the pin or the cross on the right-hand side:

If you compare the form when you create a new project with the one above when its running, you'll see that they look very similar. But the one above is actually a real programme, something you could package and sell to unsuspecting village idiots.

So what's going on? Why the two different views? Well, Visual Basic has two distinct environments, a Design environment and a Debug environment. Design Time is where you get to play about with the form, spruce it up, add textboxes, and buttons, and labels (and code, of course ); Debug is where you can test your programme and see how well it performs. Or doesn't perform, as is usually the case.

But don't worry about the terminology, for the time being. Just be aware that there's a two step process to VB programming: designing and debugging.

So, let's get on and do some designing! Before we can start designing a form, though, we need some tools. And where are tools kept? In a toolbox!
SOURCE:home and learn
« Last Edit: January 04, 2013, 09:19:14 PM by Sub5 »

Offline mfoniso

Re: Adding Controls Using the Toolbox
« Reply #2 on: January 05, 2013, 01:22:48 PM »
Things like buttons, textboxes, and labels are all things that you can add to your Forms. They are know as Controls, and are kept in the Toolbox for ease of use.

The Toolbox can be found on the left of the screen. In the picture below, you can see the toolbox icon next to Form1 (VB Net 2008):

VB Net 2010:

VB NET 2012:

To display all the tools, move your mouse over the toolbox icon. You'll see the following automatically appear (the 2012 version looks similar to the one on the right, below):

There are seven categories of tools available. The toolbox you'll be working with first is the Common Controls toolbox. To see the tools, click on the plus symbol next to Common Controls. You'll see a long list of tools:

As you can see, there are an awful lot of tools to choose from! For this first section, we'll only be using the Button, the TextBox and the Label.

If you want to keep the toolbox displayed, click the Pin icon next to the X. To close the toolbox, simply move your mouse away. Or just click the word Toolbox again in version 2012.
Please do not PM me questions, ask all your questions in the forum, for others to learn from.

All Student Forum

Re: Adding Controls Using the Toolbox
« Reply #2 on: January 05, 2013, 01:22:48 PM »

Offline mfoniso

Re: Adding a Tool (Control) to your Form
« Reply #3 on: January 05, 2013, 07:00:16 PM »
Let's start by adding a textbox to our form. (The following screenshots are taken from the more colourful previous versions of Visual Studio Express. Version 2012 is rather grey and bland. So don't worry that you forms don't look exactly the same, if you have this version.)

With the Common Controls displayed, do the following:

    Locate the TextBox tool
    Double click the icon
    A textbox is added to your form

The textbox gets added to the top left position of your form. To move it down, hold your mouse over the textbox and drag to a new position:

Notice the small squares around the textbox. These are sizing handles. Move your mouse over one of them. The mouse pointer turns into an extended line with arrowheads. Hold your left mouse button down and drag outwards. The textbox is resized. Play around with the sizing handles until you're happy with the size of your textbox.

One thing you will notice is that you can't make the size any higher, but you can make it wider. The reason why you can't make it any higher is because the default action of a textbox is to have it contain only a single line of text. If it's only going to contain one line of text, Microsoft reasoned, there's no reason why you should be able to change its height. A textbox can only be made higher if it's set to contain multiple lines of text. You'll see how to do this soon.

    Create two more textboxes by double clicking on the textbox icon in the toolbar (Or Right-click on the selected textbox and choose Copy. Then Right-click on the Form and choose Paste.)
    Resize them to the same size as your first one
    Line them up one below the other with space in between
    Try to create something that looks like the one below

Source: Home and Learn
Please do not PM me questions, ask all your questions in the forum, for others to learn from.

Offline mfoniso

Re: Adding a Label to your Form
« Reply #4 on: January 05, 2013, 07:37:46 PM »
Let's add some labels near the textboxes so that your users will know what they are for.

    Locate the label control in the toolbox
    Double click the label icon
    A new label is added to your form
    It should look like the one below

Click on the label to select it. Now hold your left mouse button down on the label. Keep it held down and drag it to the left of the textbox.

Create two more labels, and position them to the left of the textboxes. You should now have a form like this one:

To see what your Form looks like as a programme, click Debug > Start from the menu bar. Or press F5 on your keyboard:

To stop the programme from running, you can do one of the following:

1. Click the Red X at the top right of your Form
2. Click Debug > Stop Debugging from the menu bar
3. Press Shift + F5 on your keyboard

You can also click the Stop button on the VB toolbars at the top, as in the image below:

All right, we're getting somewhere. We now have a form with textboxes and labels, something that looks like a form people can fill in. But those labels are not exactly descriptive, and our textboxes have the default text in them. So how can we enter our own text for the labels, and get rid of that default text for the textboxes?

To do those things, we need to discuss something called a Property.
Please do not PM me questions, ask all your questions in the forum, for others to learn from.

All Student Forum

Re: Adding a Label to your Form
« Reply #4 on: January 05, 2013, 07:37:46 PM »

Offline Ryley Jed

Re: Coding for Beginners In VB.NET
« Reply #5 on: August 24, 2013, 05:55:29 AM »
it's very usefull for me to learning more about vb ..
newbielink: [nonactive]

Offline Audreyjohnson

Re: Coding for Beginners In VB.NET
« Reply #6 on: September 01, 2014, 11:47:03 AM »
Thanks for sharing this valuable post about here..
newbielink: [nonactive]


With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name: Email:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
Students goes to?:
What letter is missing in this word 'Gogle':

Related Topics

  Subject / Started by Replies Last post
4 Replies
Last post April 02, 2018, 10:37:51 AM
by Sub5
0 Replies
Last post April 26, 2013, 06:17:16 AM
by vimaladamayanti
0 Replies
Last post September 24, 2013, 12:36:05 PM
by debby
0 Replies
Last post April 08, 2016, 09:09:52 PM
by mfoniso
0 Replies
Last post May 29, 2017, 10:49:43 AM
by mfoniso