Archive for September, 2011

Adding a Control to a Form

Number of View: 2

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): The Visual Basic .NET Toolbox VB Net 2010: The toolbox in VB NET 2010 Express To display all the tools, move your mouse over the toolbox icon. You’ll see the following automatically appear: ToolBox Categories The toolbox in VB NET 2010 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: Common Controls in the VB ToolBox 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. In the next part, we’ll see how to add a textbox to the form.

VN:F [1.9.8_1114]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.8_1114]
Rating: 0 (from 0 votes)

Popularity: unranked

The Default Form

Number of View: 0

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:

A VB NET Form Running as a Programme

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

If you compare the first form with the one above, 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!

VN:F [1.9.8_1114]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.8_1114]
Rating: 0 (from 0 votes)

Popularity: unranked

Make a Start with VB .NET

Number of View: 0

Launch your Visual Basic .NET or Visual Studio software.

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:

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. That’s a very daunting piece of software, hey? Well, don’t worry. We’ll break it down bit by bit in the next few sections, and pretty soon you’ll be zipping your way around it like a pro!

VN:F [1.9.8_1114]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.8_1114]
Rating: 0 (from 0 votes)

Popularity: unranked

« 1 2 3 4 5 6 7 8 9 10 »