Download presentation
Presentation is loading. Please wait.
Published byHendra Lesmana Modified over 6 years ago
1
Introduction to computers, the Internet & VB .Net
Tutorial 1 Introduction to computers, the Internet & VB .Net
2
Introduction to Visual Studio .Net and IDE
Tutorial 2 Introduction to Visual Studio .Net and IDE
3
Start Page
4
Creating a New Project Select Windows Application
Select Visual Basic Projects Specify project name Specify location
5
Design View
6
Solution Explorer Expanded mode Collapsed mode Form file Continue
7
Categorized & Alphabetic listing options
Properties Window Categorized & Alphabetic listing options Property name Expanded mode Property value Collapsed mode
8
Using Help Contents Index Search MSDN (
9
Saving Project File > Save All Do not use File > Save or Save As
To copy a project, use Windows Explorer to copy the entire project folder
10
Introduction to Visual Programming
Tutorial 3 Introduction to Visual Programming
11
Opening an Existing Project
Open VB .Net Click the Open Project button Open the Solution file with the sln file extention Continue
12
If the Form does not show in the Design window, double-click on the Form file in the Solution Explorer.
13
RGB Color Scheme Example: 255, 237, 169
Each number represents the amount of color of Red, Green, and Blue respectively The higher the number, the more the color. e.g. 0, 0, 255 is blue. The value of color range between 0 and 255 (00 FF in Hexadecimal) Continue
14
What Happens After Debug
After a successful Debug run, VB .Net creates an executable (exe) file in the Bin folder of the Project.
15
Designing the Inventory Application.
Tutorial 4 Designing the Inventory Application.
16
Naming Controls Instead of using generic names created by VB .Net, use unique and informative names E.g. TextBox1 vs. txtSalesAmount The txt prefix indicates it is a TextBox control “SalesAmount” tells it is something about sales amount Sentence-style capitalization. Capitalize the first letter of each word instead of a blank space Continue
17
Suggested Prefixes for Controls
18
Label and Textbox Controls
Labels: Displaying information or output. Textbox: Read in input data Continue
19
What Happens After Debug
After a successful Debug run, VB .Net creates an executable (exe) file in the Bin folder of the Project.
20
Introducing Code Programming
Tutorial 5 Introducing Code Programming
21
What is Class Building blocks of a program
Provided by VB .Net Framework Class Library Template definition of the methods and variables in a particular kind of object VB Windows forms inherit definitions from the System.Windows.Forms.Form class.
22
Object-Oriented Programming (OOP)
Programming language model Organized around "objects" rather than "actions" and data rather than logic Subclass and inheritance Class 1 Class 2 Food Fruit Apple Machine Computer Sources: techtarget.com Continue
23
Polymorphism: Actions or behaviors that share the same essence would have a common name even though they belong to different objects. E.g., opening (action) a computer application (object) is different from opening a door in terms of operations. However, the name of the action for both objects is open since the idea is the same. ComputerApplicatoin.Open Door.Open
24
Structures of OOP Action Value Object.Behavior Object.Method
Object.Property Object.Attribute
25
Val and Str Functions Val: Returns a numeric value of an argument (string value) E.g. Val(“123”) 123 Str: Returns a string value E.g. Str(123) “123”
26
Introducing Variables, Memory Concepts & Arithmetic
Tutorial 6 Introducing Variables, Memory Concepts & Arithmetic
27
Variables Holds data Controls for Design Programming, Variables for Code Programming Text Property Data Variable Manipulate data w/o showing to users Store data w/o adding or using controls Hold numbers, data & time, text, and etc. Continue
28
One type of variable can take the same type of data. E.g.
intCount = 15 (OK) intCount = “Pat” (not OK) intCount = “15” (not OK) Must be declared. E.g. Dim intCount As Integer Dim sngPrice As Single Continue
29
Steps of Using Variables
Declare Input: Assign a value by reading in from a control or other source Process: Use or manipulate Output: Put the value to a control or other object
30
Example 1: Dim intTotal As Integer intTotal = Val(txtTotal.Text)
intTotal = intTotal + 10 txtTotal.Text = Str(intTotal)
31
Example 2: Dim intTotal As Integer Dim intExtra As Integer
intTotal = Val(txtTotal.Text) intExtra = 10 intTotal = intTotal + intExtra txtTotal.Text = Str(intTotal)
32
Example 3: Dim intTotal As Integer Dim intExtra As Integer = 10
intTotal = Val(txtTotal.Text) intTotal = intTotal + intExtra txtTotal.Text = Str(intTotal)
33
Data Types of Variables
Memory Allocation Value Range Boolean 2 bytes True or False. Char 0 through (unsigned). Date 8 bytes 0:00:00 on January 1, 0001 through 11:59:59 PM on December 31, 9999. String Depends on platform 0 to approximately 2 billion Unicode characters. Short -32,768 through 32,767. Integer 4 bytes -2,147,483,648 through 2,147,483,647. Long -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807. Single E+38 through E-45 for negative values; E-45 through E+38 for positive values. Double E+308 through E-324 for negative values; E-324 through E+308 for positive values. Decimal 16 bytes 0 through +/-79,228,162,514,264,337,593,543,950,335 with no decimal point; 0 through +/ with 28 places to the right of the decimal; smallest nonzero number is +/ (+/-1E-28).
34
Integer Stored as 32-bit (4-byte) integers ranging in value from -2,147,483,648 through 2,147,483,647. Provides optimal performance on a 32-bit processor, as the smaller integral types are slower to load and store from and to memory. You can convert the Integer data type to Long, Single, Double, or Decimal without encountering a System.OverflowException error.
35
Single Stored as IEEE 32-bit (4-byte) single-precision floating-point numbers ranging in value from E+38 through E-45 for negative values and from E-45 through E+38 for positive values. Single-precision numbers store an approximation of a real number. Can be converted to the Double or Decimal data type without encountering a System.OverflowException error.
36
String Stored as sequences of 16-bit (2-byte) numbers ranging in value from 0 through 65535 Each number represents a single Unicode character. A string can contain up to approximately 2 billion (2 ^ 31) Unicode characters The first 128 code points (0–127) of Unicode correspond to the letters and symbols on a standard U.S. keyboard The second 128 code points (128–255) represent special characters, such as Latin-based alphabet letters, accents, currency symbols, and fractions The remaining code points are used for a wide variety of symbols
37
Prefixes for Variables
Data Type Prefix Boolean bln Integer int Byte byt Long lng Currency cur Short sht Date(time) dtm Single sng Double dbl String str
38
Mathematical Operation ClassAve = TotalScores / NumOfStudents
Arithmetic Operators Order Operator Mathematical Operation Example 1 ( ) Parentheses 2 ^ Exponentiation CubicSpace = Length ^ 3 8 = 2 ^ 3 3 - Negation - Num1 4 * or / Multiplication Division Total_Sales = Unit_Price * Count ClassAve = TotalScores / NumOfStudents 5 \ Integer Division (DIV). The whole number portion of the answer in a division. The decimal position is dropped. CarsCanFitIn = AreaOfLot \ CarDim 10 = 215 \ 20 15 is leftover Continue
39
Mathematical Operation Example
Order Operator Mathematical Operation Example 6 MOD Integer Remainder Division. The whole number portion of a remainder in a division. If the divider is greater than the number it is dividing, then the number become the remainder of the MOD division. BoothSpace = 3 MOD 10 3 = 3 MOD 10 7 + or - Addition Subtraction Total = Num1 + Num2 Profit = Sales - Expenses & String concatenation FullName$ = First$ & Last$
40
Using Debugger Demo
41
Introducing CheckBoxes & Message Dialogs
Tutorial 8 Introducing CheckBoxes & Message Dialogs
42
Basic Structure of Simple Codes
Declare variables for input and output controls Use appropriate data types and prefixes Input Read in assign input values to input variables Use Val conversion function for numeric input data Process Using input and other elements, calculate the result. Ouput Assign the result into the output control.
43
Example
44
Error Handling Check error Resolve error Input Process Output
45
Code Structure with Error Handling
If [error condition] Then do something, e.g. MessageBox Else input process output End If Or
46
If [error condition] Then
do something, e.g. MessageBox or Exit Sub End If input process output
47
Basic Structure If [condition] Then code(s) to be executed End If
If intGrade >= 60 Then lblCourseResult.Text = “Passed” Continue
48
Coding with CheckBox If chkMembership.Checked Then or
If (chkMembership.Checked = True) Then If (chkMembership.Checked = False) Then
49
Logical Operators And (AndAlso) Or Not Xor Logical Operator Meaning
Example And (AndAlso) Only if both conditions are true, then the result is true. If [condition1] And [condition 2] Or (OrElse) If at least one condition is true, then the result is true If [condition1] Or [condition 2] Not Negation of the condition. If the condition is true, the result is false. If the condition is false, then the result is true. If Not [condition] Xor If one and only one of the conditions is true, then the result is true. If all conditions are either true or false, then the result is false. So, if all conditions are false, then the result is false. If all conditions are true, then the result is also false. If blnStake Xor blnBurger Then strCustomer = “Satisfied” End If If a customer is served with either a stake or a burger, she is happy. But if the customer is not served anything or both, then she is not happy. (too hungry or too full)
50
MessageBox Function See textbook pages 174 and 175 for details
51
Introducing Do While & Do Until Loops & Repetition Statements
Tutorial 9 Introducing Do While & Do Until Loops & Repetition Statements
52
Do While Loop Do While [condition] action(s) Loop intCounter = 0
Do While (intCounter < 10) intSumOfNumbersUpto10 += intCounter intCounter += 1 Continue
53
Repeats the actions as long as the condition is true
The condition must change, otherwise infinite loop will occur. Within the loop add code(s) to change the condition that eventually become false
54
Do Until Loop Do Until [condition] action(s) Loop intCounter = 0
Do Until (intCounter >= 10) intSumOfNumbersUpto10 += intCounter intCounter += 1 Continue
55
Repeats the actions as long as the condition is false
The condition must change, otherwise infinite loop will occur. Within the loop add code(s) to change the condition that eventually become true
56
Coding with ListBox Remove items in the ListBox
lstStudents.Items.Clear( ) Class.SubClass.Behavior or Add items to the ListBox lstStudents.Items.Add (“Name” & ControlChars.Tab & ControlChars.Tab & “Course”)
57
Example Dim intCounter As Integer = 1
Dim intSumOfNumbersUpto10 As Integer = 0 Do While (intCounter < 10) intSumOfNumbersUpto10 += intCounter lstNumbersUpto10.Items.Add(“Number “ & intCounter & ControlChars.Tab & intSumOfNumbersUpto10) intCounter += 1 Loop
58
What is a Computer? Examples? History A device capable of
Performing computation Making logical decisions Faster than human Process data using computer programs
59
What is a computer program?
A set of instructions a.k.a. application & software
60
Computer Organization
Input devices: keyboard, mouse, scanner, microphone, digital camera, & etc. Output devices: monitor, printer, projector, device control, & etc. Memory: Primary memory, RAM. Voatile. Arithmetic & logic unit (ALU): Performs calculation, logical comparison, decision making. Continue
61
Central processing unit (CPU): Administrates process operations.
Secondary storage: Long-term storage of applications and data. E.g. hard drive, CD/DVD drive , & etc.
62
Three Types of Languages
Machine language: A natural language of a particular computer machine dependent. Continue
63
High-level language: More convenient for programmers.
Assembly language: English-like. Translator program called assembler converts to machine language. LOAD BASEPAY ADD OVERPAY STORE GROSSPAY High-level language: More convenient for programmers. GrossPay = BasePay OverPay
64
High level languages Visual Basic .Net: Evolved from Visual Basic. GUI. Object Oriented. Pascal, C, C++, C# COBOL Java HTML?, JavaScript?, VBScript?
65
Language Relationships
Refer to
66
What is .Net A set of software technologies for connecting information, people, systems, and devices. Based on Web services—small building-block applications that can connect to each other as well as to other, larger applications over the Internet. Continue
68
Object Oriented Programming
Example: What if the replicater does not use OOP? Structure: Object.Property or Object.Attribute Object.Behavior or Object.Method Class: Related objects. E.g. car, wheel, hub, bolt, & etc.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.