Professional Documents
Culture Documents
Visual Basic: by Leo Karlo Primero
Visual Basic: by Leo Karlo Primero
4/18/2010 2
Visual Basic is What?
• A GUI
– Graphics, tools, objects
• An OOP – “*Object Oriented Programming”
– Objects make the application.
4/18/2010 4
Visual Basic is Object Oriented
Objects to play around with Screen shot of VB tool box
• It all begins with a web
form…
– Then place in any object unto
it
• A radio button, a text box, a
progress bar, and anything…
• They make application
construction look so easy
• Visual Basic makes
programming faster
4/18/2010 5
Don’t take my word for it…
4/18/2010 7
What is a class?
• A class is a contemporary of an object Private Sub Form1_Load(ByVal sender As
System.Object, ByVal e As
• It makes up the object System.EventArgs) Handles
– Underneath it are its codes MyBase.Load
• Divided into subroutines cboDistributorNo.Items.Add(100)
cboDistributorNo.Items.Add(101)
• Describes how the process
cboModelNo.Items.Add("puri-clear")
work
• Main class is always at the top of the cboModelNo.Items.Add("Envirn_Safe
code ")
• What this codes does is to place the cboDistributorNo.SelectedIndex = 0
numbers into the cboModelNo.SelectedIndex = 0
cboDistributorNo.Items End Sub
• This can also be an option statement
(rules of processing)
• You are going to see its output
4/18/2010 8
Before and After…
BEFORE… AFTER…
4/18/2010 9
A class and its codes
is like a teacher and its students
A teacher instructs his student
Class and codes on what to do
• A class cannot function Poor guy…
without its codes
• A class name will appear first
– But no functions
• It is an empty classroom with
no activity
• The teacher is bored (no brain
activity)
• A class needs codes to be
active!
– It will be bored like the teacher.
4/18/2010 10
Codes within classes are instances!
• Instances are…
– Data, string, procedures, events, calculations and
etc.
– They help make class work
4/18/2010 11
Coding part 1 – Naming conventions
*“The first three letters of the name should be a
lowercase prefix indicating the control’s type.“
4/18/2010 13
Known prefix list
• lbl = Label
• txt = Text Box
• cbo = Combo Box
• btn = Button
4/18/2010 14
To give an object a name
• Go to Properties
Window
• Find Name
• Type in value
4/18/2010 15
Coding Part 2 – Assigning a Variable
• A variable is an instance
• You must dim it first
– Ex:
Public Class frmTuitionCalc
Dim ResidenceStatus As Integer
– Then follow it up with an As statement
4/18/2010 16
CodingHow
Partto2Give
– Assigning
it a valuea Variable
4/18/2010 17
lblDateString.Text = txtDayOfWeek.Text & ", " _
.Text is text property that will
affect the highlighted area
• Here is the output of it to
show you what I am talking
about
• Look
4/18/2010 18
What happened was
• At the last slide
lblDateString.Text gathered all the textual data of
the other variables and placed them in one string.
4/18/2010 19
Coding Part 3: Performing calculations
• Operators: • Examples
– + is addition Integer = 5 + 5;
– - is subtraction Integer = 5 MOD 5;
– *MOD gets remainder (remainder shows)
– / is *floating point Integer = 5 / 5;
division
– \ is *Integer division
– *^ is exponentiation
4/18/2010 22
Here is how it works
Before After
4/18/2010 23
Coding Part 6: The Case Statement
Another condition statement Example
• There can be several Private Sub rbtInternational_Click(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
options rbtInternational.Click
ResidenceStatus = 2
• However a condition must End Sub
be met for one of them to Case Is >= 12
Select Case ResidenceStatus
work Case 0
Tuition = 1500
Case 1
Tuition = 2300
Case 2
Tuition = 3200
End Select
*NOTE: This is a shortened version of the actual code
4/18/2010 24
How it works
The code’s decision Here it is
• User inputs hours taken
• Then tuition will output
base on a case
• Typed-in 12 hours and
checked International
– International is Case 2
• Outputs $3,200
4/18/2010 25
My view on Visual Basic
• I find it faster to finish applications but it takes time to learn.
• The community is quite active
– There are people helping each other online
• I find it to be very reliable
• A programmer can decide how to tighten his application’s security
– I have a template that has a log-in feature
• MSDN is still maintaining it with bug fixes and updates
– As long as the user downloads them
• When anyone needs help with Visual Basic he can ask help from MSDN
• Visual Basic has its own Online Help
• Visual Basic’s history has shown me that MSDN still updates it and even changes
VB’s external and internal structures.
• Visual Basic’s unique features made it an all-around programming language
– Besides Programmers coded VB’s codes to create advanced applications
• One major downside is that it does not focus on actual programming
– People may not be programmers to use Visual Basic
4/18/2010 26
Outcome for Visual Basic
• So far for what I see Visual Basic is persistent
and may last for a very long time.
• I believe that after it fixes up its problems
Visual Basic will still have a lot of customers
that are willing to quickly make applications.
4/18/2010 27
Works Cited
Gaddis, Tony, and Kip Irvine. Starting out with Visual Basic 2008.
Fourth. Boston: Pearson Education, Inc., 2008. 7. Print.
Gaddis, Tony, and Kip Irvine. Starting out with Visual Basic 2008.
Fourth. Boston: Pearson Education, Inc., 2008. 14. Print.
Gaddis, Tony, and Kip Irvine. Starting out with Visual Basic 2008.
Fourth. Boston: Pearson Education, Inc., 2008. 122. Print.
n.p., "Closer Look: Converting from One Variable Type to Another."
MSDN.Microsoft.com. MSDN, n.d. Web. 18 Apr 2010.
<http://msdn.microsoft.com/en-
us/library/8bzk8e8c%28v=VS.90%29.aspx>
Mabbut, Dan. "What is Visual Basic?." VisualBasic.About.com.
About.com, n.d.. Web. 18 Apr 2010.
<http://visualbasic.about.com/od/applications/a/whatisvb.htm>.
4/18/2010 28
FIN
GOD DESERVES THIS GLORY
4/18/2010 29