Wiki:
Page name: Visual Basic Programming [Exported view] [RSS]
2007-12-20 18:17:19
Last author: Imperator
Owner: Shadow-ofDeath
# of watchers: 2
Fans: 0
D20: 18
Bookmark and Share

Visual Basic Programming - Concepts




Teacher: [Shadow-ofDeath]


This class is meant to offer information on the programming language Microsoft Visual Basic 6 (VB6). It is highly suggested that students own a copy of VB, that way they can create a hands-on experience for themselves. If you do not have a copy, you may still learn how to write code in VB. Creating the form and setting properties will only be lightly touched, and the class will mainly focus on code. To go to the next page, follow this link: Visual Basic Code. To go back to the Academy, please click here: Elftown Academy


<img:stuff/ETA_divider.jpg>


Students:
1. [SpiralDragon]
2. [One Ruler]
3. [A Beautiful Oblivion]


<img:stuff/ETA_divider.jpg>


Course Outline:
1. Declare Everything!
2. Interface
3. Changing Properties with Code
4. Variables
5. If... Then... (Else...) Statements


<img:stuff/ETA_divider.jpg>


Declare Everything!



I cannot stress this enough. Declare every variable you have, or you will have a much harder time programming. Here's the basic structure for declaration:

Dim Variable as Type

All you have to do is change Variable into something meaningful and Type into a proper type. Types are things such as: Integer, Long, Single, Double, String, Byte, etc. An example of declarations is:

Dim intCounter as Integer
Dim strNames as String
Dim DoctorList(20) as String
Dim Billy as Byte



<img:stuff/ETA_divider.jpg>


Interface



Alright, interface is basically summed up as the form and everything on it. Since most people won't have a copy of it, this is about all most people will get. When you create the interface, try to make sure that everything looks similar, especially if you are using multiple forms.


<img:stuff/ETA_divider.jpg>


Changing Properties with Code



Properties are information about controls. Each one changes the control it applies to in some way. To change properties with code, the statement is as follows:

Control Name.Property = New Setting

Examples of this is use are:

Image1.Top = 230
txtName.Text = "VB Rocks"
lblDisplay.Caption = "Hello World"



<img:stuff/ETA_divider.jpg>


Variables



Variables are data containers. The normally have a meaningful name, but can also be random combinations of letters and numbers. Types of variables include: Long, Single, Double, String, Byte, Variant, Date, etc. Here are summaries of the most frequently used types:
- Integer: Integer value, can be positive or negative.
- String: Any assortment of words, letters, or numbers.
- Currency: Decimal values or integers, in regular number form.
-Variant: Changing type, can hold anything.


<img:stuff/ETA_divider.jpg>


If... Then... (Else...) Statements



If... Then... (Else...) Statements are probably one of the most used elements in coding. These follow one of these simple structures:

If Conditions Then Statements

OR

If Conditions Then
    Statement...
    Statement...
    etc.

End If

OR

If Conditions Then
    Statement...
    Statement...
    etc.

Else
    Statement...
    Statement...
    etc.

End If

Basically these mean: If this is true then do this, else do this.


<img:stuff/ETA_divider_small.jpg>


Back to Computer Science or the Elftown Academy


<img:stuff/ETA_divider_small.jpg>

Username (or number or email):

Password:

2005-04-18 [One Ruler]: thanks teach

2005-04-18 [Shadow-ofDeath]: No problem, I'll add you to the list.

2005-05-30 [Kitara Softpaw]: *waves hand* Can I learn?? *smiles malisciously* I know you just want to deal with even more of my craziness!! ^^

2005-05-30 [Kitara Softpaw]: *bangs head on desk* Teacher, I don't get it!!

2005-05-31 [Shadow-ofDeath]: Ow!!!

2005-06-21 [Kitara Softpaw]: *sits up* It doesn't hurt, but this is very confusing...I barely understand HTML

2005-06-29 [A Beautiful Oblivion]: okay, you dragged me into this, my fellow Monty Python lover, I'll try my best, but remember: I'm easily confused :D

2005-07-01 [Shadow-ofDeath]: Muhahaha, read the information and try the Project at the end!

2005-07-03 [A Beautiful Oblivion]: Chya. I'll try it, though

2005-07-03 [Shadow-ofDeath]: Alright, Have fun. If you need help message me.

2005-07-11 [A Beautiful Oblivion]: Hahaha, I need a LOT of help

2005-07-13 [Shadow-ofDeath]: Help is what I am here to give!

2005-08-07 [A Beautiful Oblivion]: I'm sorry, I haven't been coming here a lot. My bad

2005-11-03 [SpiralDragon]: tardy tardy TARDY! ^^*

2005-11-04 [Shadow-ofDeath]: Noob, Spiral... Noob.

2006-11-20 [SpiralDragon]: ...

2006-11-20 [Shadow-ofDeath]: It only took you 16 days less than one year to post... nice job!

Show these comments on your site

Elftown - Wiki, forums, community and friendship.