Professional Documents
Culture Documents
NE T
200 3
Mr. Greg A. dela Cruz, Jr., MSIT
Instructor
The His tory of Vi sual B asi c
Visual Basic 1.0 appeared in 1991. Up to that point,
the only way to do the Windows programming was
to use C code, and lots of it – you had to write five
pages of C code to produce even a blank window.
Nonrectangular windows
ACTIVITIES :
Opening VB.Net
Exploring the VB.Net IDE
Creating a Windows Application
Creating a Web Application
Creating a Console Application
Openin g VB.Ne t 2 003
1. Click Start
2. Point to Programs
3. Point to Microsoft Visual
Studio.Net 2003
4. Microsoft Visual Studio.Net 2003
Cre ati ng a Wi nd ows
Ap pl ic ati on
Click File, New, Project
Click Visual Basic Projects in the Project
Types box
Click Windows Application in the
Templates box
Type the Name of the Project
Specify the Location
Type the Name of the Solution
Click OK
Dif feren ce o f Solu tio n a nd
Pr oj ect
Solution – It is composed of one or more
projects (e.g. Business Solution : Accounting,
Payroll, Inventory, etc)
Lines 3 & 4 displays Hello World! and Press any key… respectively
Line 5 waits for the user input before exiting
That meant that you would have to package the needed DLLs
in your installation package to be installed on the target
machine with your application.
OUTPUT
VB.Net Application
Compile
MS Intermediate
Language
Common Language
Runtime (CLR) Binary Codes
The CLR can run programs created not only in VB but also
in Visual C++, Visual C#, Visual J# and other Visual
Studio languages
MODULE/S
MSIL Codes
An illustration….
DLL
– acronym for Dynamic Link
Libraries
- a set of Windows functions
designed to perform a
specific class of operations.
<Back
MASTERING THE Visual Basic Language:
DATA, OPERATORS, CONDITIONALS &
LOOPS
Examples:
And Ansi As
Byte ByVal Boolean
ByRef Catch CBool
CByte CChar CDate
Visual Basic.Net Statements
A VB.NET statement is a complete VB instruction. Statement can
contain:
Const Pi = 3.14159
Creating Enumerations
• You can make use of Enumerations when you want to
group a number of constants.
Example:
Enum Days
Sunday = 0
Monday = 1
Tuesday = 2
Wednesday = 3
End Enum
Example:
txtScore1.text = bytScores(0)
Creating a Dynamic Array
• Dynamic array is useful if you
don’t know how much data you
want to store ub ab array before
your program runs.
Example:
Dim bytScores() as Byte
Redim bytScores(20)
bytScores(0) = 25
bytScores(1) = 30
bytScores(20) = 77
Redim Preserve bytScores(25)
bytScores(21) = 80
Making Decision with If and Select
Statements
IF Statement Example
If bytScores(0)<75 then
txtMark.text = “Failed”
ElseIf bytScores(0)>=75 and bytScores(0)<80 Then
txtMark.text = “Passed”
ElseIf bytScores(0)>=80 and bytScores(0)<86 Then
txtMark.text = “Very Good”
ElseIf bytScores(0)>=86 and bytScores(0)<96 Then
txtMark.text = “Excellent”
ElseIf bytScores(0)>=96 and bytScores(0)<=100 Then
txtMark.text = “Extra Ordinary”
Else
txtMark.text =“Invalid”
End If
Select Statement Example
Select Case bytScores(0)
Case Is <75
txtMark.text = “Failed”
Case 75 to 79
txtMark.text = “Passed”
Case Else
txtMark.text = “Invalid”
End Select
For, For Each, While and Do loops
Use use LOOPS to execute a series of
statements repeatedly.
Example : For
Dim bytCounter as Byte
For bytCounter = 1 to 100
cboScore.Items.Add bytCounter
Next bytCounter
Example: For Each