Download presentation
Presentation is loading. Please wait.
Published bySybil Clarke Modified over 9 years ago
1
Visual Basic is an object-oriented language used to write application programs that run in Windows or on the Internet using a graphical user interface (GUI). The three steps to creating a Visual Basic project are (1) define the user interface, (2) set the properties, and (3) write the Basic code. 1- 1
2
Design/Define the User Interface Plan/Set the Properties Plan/Write the Code Test and Debug 1- 2
3
Windows Graphical User Interface Window = Form Toolbox of elements called Controls ◦ Text Box ◦ Label ◦ Check Box ◦ Button 1- 3
4
Procedural ◦ Program specifies exact sequence Event Driven (VB 6.0 and previous) Object Oriented Programming (VB.NET) ◦ User controls sequence Click event Double Click event Change event 1- 4
5
Object ==> Noun ◦ Form and Controls Property ==> Adjective ◦ Color of a Form Method ==> Verb ◦ Move a Form Event ==> Occur when the user takes action ◦ User clicks a button, User moves a form Class ==> Template to create new object ◦ Each control added is an Instance of a Class 1- 5
6
Used to reference object's properties and methods in code ◦ Object dot Property Form.Text, TextBox.Text ◦ Object dot Method Form.Hide( ), TextBox.Focus( ) To reference an object's events use an underscore instead of a dot Button_Click, ListBox_TextChanged 1- 6
7
Class = automobile Properties = make, model, color, year Object = each individual car ◦ Object is also an Instance of the automobile class Methods = start, stop, speedup, slowdown Events = car arrives, car crashes 1- 7
8
One Solution File.sln Solution User Options File.suo Project Files.vbproj Project User Options File.vbproj.user Form Files.vb Resource File for the Form.resx 1- 8 Open this file directly to work on a Project
9
Integrated Development Environment (IDE) Form Designer Editor for entering code Compiler Debugger Object Browser 1- 9
10
Toolbars Document Window Form Designer Solution Explorer Properties Window Toolbox 1- 10
11
1- 11
12
1- 12
13
Holds the tools you place on a form 1- 13
14
Design Time Run Time Break Time 1- 14 “Look at the Title Bar”
15
Always use standard names for objects No spaces or punctuation marks 3 letter lowercase prefix identifies control type Button-btn Label-lbl Form-frm If multiple words capitalize 1st letter of each word 1- 15
16
1- 16 Object ClassPrefixExample FormfrmfrmDataEntry ButtonbtnbtnExit TextBoxtxttxtPaymentAmount LabellbllblTotal Radio ButtonradradBold CheckBoxchkchkPrintSummary Horizontal ScrollBarhsbhsbRate Vertical ScrollBarvsbvsbTemperature PictureBoxpicpicLandscape ComboBoxcbocboBookList ListBoxlstlstIndegredients
17
1- 17 lblMessage btnPush btnExit
18
1- 18 Rename Label1 to lblMessage
19
Label ◦ NamelblMessage ◦ Textleave blank Button 1 ◦ NamebtnPush ◦ TextPush Me Button 2 ◦ NamebtnExit ◦ TextExit Form ◦ NamefrmHello ◦ TextHello World by your name 1- 19
20
The default startup object if Form1 The name of the form should always be changed to adhere to naming rules Using Project menu, Properties change the startup object to match the new name 1- 20
21
1- 21
22
While the project is running the user can perform actions Each action by the user causes an Event to occur Write code for the events you care about, the events you want to respond with code Code is written as event procedures VB will ignore events for which you do not write code 1- 22
23
Declarations Section Class list Method list 1- 23
24
Also known as Comment, used for documentation Non-executable Automatically colored Green in Editor Begins with an apostrophe ( ' ) ◦ On a separate line from executable code ◦ At the right end of a line of executable code 1- 24 ' Display the Hello World message
25
Assigns a value to a property or variable Operates from right to left Enclose text strings in quotation marks (" ") 1- 25 lblMessage.Text=" Hello World "
26
Execute the Close Method of the Form Methods always have parentheses (this will help you distinguish them from Properties which never have parentheses) Current Form may be referenced as Me 1- 26 Me.Close( )
27
Save Project - File Menu, Save All Run Project ◦ Debug Menu, Start ◦ Start Without Full Compile (F5) ◦ Start With Full Compile(CTRL F5) Correct any Errors and Rerun ◦ Compile errors ◦ Run-Time Errors ◦ Logic errors ◦ Syntax errors 1- 27 "Help is always available from the Help Menu or by pressing F1."
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.