Professional Documents
Culture Documents
Generates startup form for new project on which to place controls. Features toolbox from which controls can be selected & placed on form. Features intellisense which prompts for completion of statement or object reference. Provides immediate syntax checking. Provides online debugging, displaying intermediate values. Provides HELP feature.
Label control
Textbox control
Button control
Basic Controls
Label : Displays information through its Text property. Textbox : Information Entry, Display, and Transfer through its Text Property. Use name of textbox to access information or respond to Gotfocus event. Button : Information Display through its Text Property. Use name of button to respond with subroutine to its Click event.
Before event driven programs, typical applications were executed by the computer under control of the application. With event driven programs, the operating system detects user interactions (mouse click, tab key, etc.), passes them to the application, and a control responds by running a subprogram.
Event
Load event occurs when form is loaded into computer memory Click event occurs when user clicks button with mouse
Textbox
tbNum2.Clear()
lblStep1.Visible = True lblStep2.Visible = False End Sub
Variables are assigned values from a data type VB data types include String, Integer, Double, and Boolean A Dim statement is used to declare a variable and the data type from which its values are assigned
Dim
Assignment
<variable> = <expression>
Assignment statement : <variable> = <expression> message = "Enter numbers to be & _ averaged in 1st and 2nd textboxes lblStep1.Text = message message = "Click Average button" lblStep2.Text = message
Windows
Analyze Problem
Example :
Design Solution
Average
Select Label Control from Toolbox Click on Form to position Label drag if desired. Click on Textbox Control from Toolbox Click on Form to position Textbox to right of Label
Name textbox tbNumber1 Holding shift key down, select label and textbox together Copy with Ctrl-C Paste with Ctrl-V (for Number2 entry. Select button Control and position below label textbox pair
Controls after selection Now set text properties of labels and the button Name textbox and button controls Write code for button click event double click on button to generate subroutine shell
Controls after setting text properties of labels and the button Name textbox and button controls Name of textbox for output Write code for button click even by double clicking button Button code should
Write code for button click event by double clicking button Button code performs following: Computes average Displays average Clears input boxes and selects first box
Test Program in debugger by switching back to design view Click debugger button
Copy Screen to Copy Buffer by doing a Print Screen Paste onto a Word Document Type your name & turn in.
Values
3, 211, -42, .
Statement Type
Syntax
Double
String
3.17, 1.414
Hello, Bob
Boolean
True, False
Repetition
Event
Load event occurs when form is loaded into computer memory Click event occurs when user clicks button with mouse Lostfocus event occurs when user tabs out of box SelectedIndexChanged occurs when user clicks a list item with mouse
Analyze Problem
Example :
Keeping track of number of numbers Keeping track of sum of numbers Computing average after each number Displaying numbers in a listbox
If <Condition> then
<statement_list>
End if
If <Condition> then
<statement_list1>
Else
<statement_list2>
Example :
Else
End If