Programming With Visual Basic - Down To The Basics

Status
Not open for further replies.

Zeppy

Member
Original poster
member
Joined
Jul 29, 2011
Posts
85
Reaction score
23
Points
5
Age
27
Location
The Internet
[Added Another Tutorial]Programming With Visual Basic - Down To The Basics

Welcome To The Guide!


Things You Will Need

  • A Brain
  • Visual Basic 2008/2010

To get Visual Basic 2010, click here


If you have those, we can begin :)


So lets start with the very down to basics, the most used Features.



Creating A New Project
j956ir.png

Start by going to file and new project. Here you will have a couple options to choose from, but by default, Windows Form is chosen. So at the bottom of this form, change the name if you please and click on Ok.

Here you will see what looks to be a program! This is the start to the process. Once you have done this, we can continue.

Uses Of The ToolBox And Purposes
29dfszl.png

Now that you have created you project, we can continue to talk about the features of Visual Basic. On the left side of the screen you will see a box that is bigger in length, than in width. This is properly known as the ToolBox. In this is where you can add components to your form by either click and drag, or click and click on form. So now that you know what the toolbox is and what its main purpose is for, we can continue to the next feature.

Properties Window
o8cqh5.png

The Properties window is located in the bottom right side of the screen. It will say it in the top left if the window. This is used for editing small things such as naming a form, or as complicated as adding a captcha. Lets continue onto the next three features.

Coding Window
bgvjnm.png

The Coding Window is the window used for adding functions or coding to a component inside your project. You can easily access this by either right clicking your form and clicking "View Code", or you can double click your form.


Debug/Build
karcwh.png

The debug button is used for creating your form and testing for errors and such. This is called "Debugging". In the debugging process, it will say that its "building" your project. This pretty much means that its loading all the components together, and well, building your project. Usually you would want to either A. Debug, or B. Build your project before saving. Now we can get to the last feature of Visual Basic.

Solution Explorer
2qmj3ib.png

The Solution Explorer is a window located just above the Properties window. The main purpose of the Solution Window is to directly go to another form, or to see all the components you have added, such as a .dll, or another form.


Now that you know the most used features and what its used for, we can begin on your first project!


Your First Project
Alright. To begin, first start a new project.

Double click your form to bring up the Coding Window.

Now that you are here, put this code into the line:
Code:
Msgbox("Your Message Here")

What this will do is create a pop-up as soon as you open your project and it will bear the message you put in between the "" 's.

Now to debug your project. Click on the green arrow located at the top middle of the window. If you followed the instructions right, as I specified above, then you will successfully debug your project and your message box will appear like this.
3599zb9.png

If you click Ok, you will see that your form will come up. We havent done anything to it yet, so itll look like a blank form.

Now lets get more in depth.


Now to create something thats a little harder than just a msgbox.


A Simple Refresher

If you would like pictures, please post your request, Id be glad to do so.

Alright, to start, load up a new project and add these components to the form
  • Timer
  • Webbrowser
  • 2 Buttons

Once you have those components up, feel free to move them around as you please, make it pretty.


Alright, now click once on button 1 and head over to the properties window. You will see that it changed and there are many new properties to change. The one were looking for is called "Text". Rename it to Start

Just like with button 1, take button 2 and rename it Stop.

Now that we have added buttons and edited properties, its time to code.

Double click your form and type the following code in:
Code:
Webbrowser1.Navigate("thebotnet.com")
What this will do is make it so as soon as you open your project, your webbrowser automatically goes to the website specified in the "" 's.

Now go back to your form and double click on the Start button and add this to the coding.
Code:
Timer1.Enabled = True
What this signalizes is to turn on or "Enable" Timer 1.

Now we reverse the process. Double click on your Stop button and type this in:
Code:
Timer1.Enabled = False
This reverses the process and turns off your timer.


Now to get to the timer's coding. You can find your timer at the bottom of the screen, just below your form window. Double click it, and add this code:
Code:
Webbrowser1.Refresh("7000")
Now you may be wondering why it says 7000 and not 7 seconds. This is the beauty of Visual Basic. You see, they didnt want to make it like 7 or 8. They wanted it in the thousandths so you can get it down the the millisecond. So for instance, say you want 5 seconds, it would be 5000. If you wanted 15 seconds, 15000 would be what you put in.

Now that you have done all these steps, its time to test your project. Start by clicking the green arrow on the toolbar just above your form window, this is the debug tool.

While in this mode, you can test whatever you have done to your form. Make sure that everything is working, and if so, youve coded your first legit program!

What should I tutorial next? A full on Webbrowser with search and cut/copy/paste, or an Advanced refresher that will have 4 speeds, slow, medium, fast, custom.


If I helped in any way, do feel free to leave a thanks :)

More Coming Very Soon!
 

bobmarley188

Member
member
Joined
Jul 29, 2011
Posts
70
Reaction score
2
Points
5
This looks good so far, I'm new to this so I will be following it :)
 

Zeppy

Member
Original poster
member
Joined
Jul 29, 2011
Posts
85
Reaction score
23
Points
5
Age
27
Location
The Internet
This looks good so far, I'm new to this so I will be following it :)

Alright :) Ill add a tutorial onto here that is a little harder than the msgbox in a little bit.
 

brazil81

Member
member
Joined
Sep 11, 2010
Posts
729
Reaction score
39
Points
31
Thanks a lot for this as I have been looking to get into coding. If you keep adding on to this,like have a daily tut, then that would be awesome!
 

Zeppy

Member
Original poster
member
Joined
Jul 29, 2011
Posts
85
Reaction score
23
Points
5
Age
27
Location
The Internet
Added a tutorial to a Simple Refresher :)
 

Zeppy

Member
Original poster
member
Joined
Jul 29, 2011
Posts
85
Reaction score
23
Points
5
Age
27
Location
The Internet
Status
Not open for further replies.