Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.

Similar presentations


Presentation on theme: "Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment."— Presentation transcript:

1 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 1 Chapter Two: Creating a First Project in Visual Basic

2 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 2 Learning Objectives Point out the elements of the Visual Basic development environment, including the title bar, menu bar, toolbar, initial form window, Toolbox, Project Explorer window, Properties window, and Form Layout window. Discuss the use of the form in creating a Visual Basic project. Understand controls and their properties. Use the label, command button, and image controls from the Toolbox to create an interface on the form. Use a message box for output from the project. Use the Code window to write the event procedure for a command button. List the different types of files that make up a Visual Basic project and be able to save a project to disk. Use the various Visual Basic help facilities to answer questions or solve problems encountered when creating a project.

3 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 3 Getting Started with Visual Basic Double-click VB icon on Desktop or use Start|Programs|Visual Basic to bring up opening dialog box

4 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 4 VB Development Environment You should start in the default MDI environment Project Window should have a white background Form should be displayed in Project Window Maximize Project Window

5 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 5 VB Development Environment Project Explorer Properties Window Form Layout Window Initial Form Window Project Window Sizing Handles Toolbox Toolbar Form Size

6 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 6 The Toolbox Label Control Textbox control Used to select a control to place on form.

7 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 7 Project Explorer Window View code View Object Change Folders Used to select the code or object or to change folders.

8 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 8 The Properties Window Used to change the properties of controls at design time. Object Box Properties List Tabs Window Name Scrollable list of properties Description Pane

9 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 9 Important Properties Name property: identifies the control –Should start with three letter prefix lbl for label txt for text box frm for form –Can include letters, numbers, and underscore Caption property for labels--what you see on screen

10 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 10 Adding a Control Double-click to add control to center of form –Can be moved around from there –Use sizing handles to change size Single Click and draw on form

11 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 11 Controls to Add to Form Label control: provides description of other controls Image control: holds a graphic image –Stretch property should be set to True –Picture property is set to graphic file Command button control: can be clicked to provide action –Caption property

12 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 12 Adding Code to Project Code goes in Code Window in event procedure Event procedure begins with “ Private Sub …” and ends with “ End Sub ” Use Msgbox command to display dialog box with message Msgbox “Welcome to Vintage Videos”

13 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 13 Design Time and Run Time You are in “Design Time” when you are designing the project and adding code You are in “Run Time” when you click the VCR Run icon You can stop the project and exit Run time by clicking the VCR Stop Icon. You can go to “Break Mode” by clicking the VCR Pause Icon.

14 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 14 The Toolbar and Menu System The VB menu system provides access to all commands. The Toolbar uses icons for more commonly used menu commands.

15 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 15 Files in Visual Basic All projects in VB have a.vbp (project) file and at least one.frm (form file) file. Always save.frm files first and then save project files. Use File|Save or File|Save as… commands for this purpose or click Disk icon on toolbar. Projects with graphics also have.frx (binary form) files. They are saved automatically. Module files have a.bas extension and are pure code files.

16 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 16 Visual Basic Help There are three types of Help: –Help menu option –context-sensitive help –and Auto Help In VB 6, Help uses the familiar Internet Explorer browser interface for the first two types of help. You can seek help by selecting Contents, Index, or Search from the Help menu item

17 Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment Adding a Control Adding Code Files in VB VB Help Introduction to Programming with Visual Basic 6.0 by McKeown and Piercy 17 Context-Sensitive and Auto Help With context-sensitive help, pressing the F1 key provides help on whatever item the cursor is located. With Auto Help, VB tries to help you with a code statement by providing: –A list of items to complete the statement –Info on the statement you have started –Tips on the type of data you are working with


Download ppt "Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment."

Similar presentations


Ads by Google