Download presentation
Presentation is loading. Please wait.
Published byAnthony Dawson Modified over 9 years ago
2
Tutorial 11 Introduction to Visual Basic zLanguage developed for special-purpose Windows applications – 1991 zUses IDE – Integrated Development Environment zCode based on Q-Basic zEvent Driven zPrebuilt graphical components (controls)
3
Tutorial 12 Two Time Frames zDesign Time – when application is being built zRun Time – when application is actually functioning
4
Tutorial 13 Steps in building a VB Application 1.Create the GUI 2.Set the properties for all controls 3.Write the code
5
Tutorial 14 1. Creating the GUI zForm – container for different components of the interface yBecomes window on desktop at Run time yShows grid for aligning controls at Design time – measured in TWIPS (1/1440 in) yGraphical elements placed on Form called Objects or Controls yControls can be added (& properties changed) during Design & during Run times
6
Tutorial 15 Opening a Project zTo open a new project, use the File menu’s New Project command. zTo open an existing project, click the Open Project button on the Standard toolbar. You also can use the Open Project command on the File menu, or the Ctrl+O key combination.
7
Tutorial 16 Five windows included in the Visual Basic Startup Screen zMain zForm zToolbox zProject Explorer (Project) zProperties
8
Tutorial 17 Visual Basic startup screen Toolbox Form
9
Tutorial 18 Default-size label control added to the form
10
Tutorial 19 Classes and Objects zEach tool in the toolbox represents a class, which is a pattern from which one or more objects, called controls, are created zEach control you create is an instance of the class from which it was created
11
Tutorial 110 Sizing, Moving, and Deleting Controls zYou can size, move, and delete a control, as well as set its properties yBefore you can delete a control, the control must be selected and the form must be the active window
12
Tutorial 111 Selecting More Than One Control zYou can change a property for more than one control at a time yClick the first control you want to select, then Ctrl-Click the remaining controls yUse the mouse pointer selection method
13
Tutorial 112 2. Setting the properties zProperties – attributes of a control (size, color, caption, etc.) yProperties Window yDefault values yForm is actually a control itself with properties
14
Tutorial 113 Project and Properties Windows
15
Tutorial 114 Caption vs Name Property zCaption property y the text seen by the user zName property yassigns a name to an object yused by the programmer to refer to an object in code
16
Tutorial 115 Name Property zMust begin with a letter zCan contain letters, numbers, and the underscore character only zMust not contain punctuation characters or spaces zMust not exceed 40 characters zUse the three-character IDs shown in Figure 1-10 (lbl, cmd, txt, frm,…etc.)
17
Tutorial 116 3. Writing the Code zEvent – action that can occur at run time zCode written in code window – can double click a control at Design time & write code or click on View Code button & select control zEvent procedure – the code that tells computer what to do if an event happens
18
Tutorial 117 Open Code Window
19
Tutorial 118 Listing of Properties and Methods
20
Tutorial 119 Editor Tab in the Options Dialog Box
21
Tutorial 120 Saving a Project zClick the Save Project button on the Standard toolbar. Provide a name for the form and the project. zYou also can use the Save As and Save Project As commands on the File menu. However, be sure to save the form before saving the project.
22
Tutorial 121 Starting and Ending a Project zTo start a project: Click the Start button on the Standard toolbar. You also can press F5 or use the Start command on the Run menu. zTo end a project: Click the End button on the Standard toolbar. You also can use the End command on the Run menu.
23
Tutorial 122 Printing an Application
24
Tutorial 123 Getting Help z Use the Help menu’s Contents, Index, or Search commands. z Click the object, window, property, and so on for which you want help, then press the F1 key.
25
Tutorial 124 MSDN Library Visual Studio 6.0
26
Tutorial 125 Caption Property’s Help Screen
27
Tutorial 126 Making an Executable File zVisual Basic’s compiler translates the application’s code into machine code zThe machine code is stored in a file with a.exe extension on its name Not in working model of VB!
28
Tutorial 127 Debugging Technique zPrint the application’s properties (Form As Text) and code. zIn the properties printout, look for a property that is not set correctly. zIn the code printout, look for an instruction that is either in the wrong object’s Code window or in the wrong event procedure.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.