McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.

Slides:



Advertisements
Similar presentations
1. Chapter 29 Creating Forms 3 Understanding Forms Word enables you to create fill-in forms to eliminate the need for storing pre-printed forms. Add.
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Chapter 5 Multitable Forms
Chapter 2 More Controls Programming In Visual Basic.NET.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
© by Pearson Education, Inc. All Rights Reserved. continued …
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
1.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Introducing More Controls Text boxCheck box Option button Command button frame image.
Text Box controls are used when users are required to type some input (during program execution), or output is displayed on the form (known as the user-
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
110-C1 Chapter 2 of the text: _ text boxes, group boxes, check boxes, radio buttons, picture boxes _ defining access keys tab sequence setting the focus.
Access Ch 5 Review.
Controls General Discussion. VB Controls Visual Basic Controls A control is the generic name for any object placed on a form Controls may be images,
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
 Insert a picture from a file  Move and delete images  Use the Picture Tools tab  Add styles, effects, and captions to images  Resize photos  Use.
Lab 9 – User Forms Design. User Forms What are user forms? –Known as dialog boxes –Major ways for getting user input An example of using user forms: Monthly.
1 CA201 Word Application Increasing Efficiency Week # 13 By Tariq Ibn Aziz Dammam Community college.
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 4Creating and Using Custom Forms.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 21 Fields and Forms.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Creating your own form from scratch.. To create a custom form, you can modify an existing form or design and create a form from scratch. In either case,
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 1 Introduction.
Chapter 2 - More Controls More controls – Text boxes - used for user input – Frames - containers to group items – check boxes - user select an option -
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 7 – Adding and.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Chapter Two Designing Applications Programming with Microsoft Visual Basic th Edition.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
2-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
IS437: Spring 2006 Instructor: Dr. Boris Jukic Controls.
Chapter Two Creating a First Project in Visual Basic.
Chapter 2 P. 1 Introducing more controls (on the Toolbox) (Fig. 2.1) - Text box - Frame - Option button - Check box - Image Example P. 44 Figure 2.2 Message.
More Controls and Their Properties Part 4 dbg --- TextBox, CheckBox, RadioButton, GroupBox, ToolTips,
More User Interface Controls User interface controls are located in the toolbox. Click the +/- signs to open/ close the different tabs of the tollbox.
McGraw-Hill © 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 2 User Interface Design.
2-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 2 User Interface Design.
Chapter 3 Automating Your Work. It is frustrating when you have to type the same passage of text repeatedly. For example your name and address. Word includes.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Developing Presentation Text Lesson 2.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al- ajmi Chapter 3 Some Visual Basic Controls and Events Visual Basic. NET.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Chapter 20. Copyright 2003, Paradigm Publishing Inc. CHAPTER 20 BACKNEXTEND 20-2 LINKS TO OBJECTIVES Create, Format, and Customize Drawn Objects Create,
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
TOOLBOX. The Toolbox Intrinsic Controls - always included in the Toolbox ActiveX Controls - separate files with ocx file extension Insertable Objects.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Lesson 4 Inserting.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
Dive Into® Visual Basic 2010 Express
How to design a Windows Forms application
Chapter 2 User Interface Design
University of Warith AL-Anbiya’a
Chapter 4 Enhancing the Graphical User Interface
Chapter 4 Enhancing the Graphical User Interface
Welcome To Microsoft Word 2016
Presentation transcript:

McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 2 McGraw-Hill/Irwin More Controls Introducing more controls Working with multiple controls Designing your applications for user convenience Coding for the controls Programming hints

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 3 McGraw-Hill/Irwin Introducing More Controls Labels: lblName.Caption=txtName.Text Text boxes: txtName.Text=“French” Frames: Groups option buttons Check boxes: chkName.Value=0, 1 or 2.caption is name Option buttons: optButton.value=True or False Images

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 4 McGraw-Hill/Irwin Tools Introduced in Chapter 2 Check box Frame Shape Image Option button Text box Line

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 5 McGraw-Hill/Irwin Text Boxes Default property is.Text –txtLastName = “Frockmeister” sets.Text prop. Alignment property –0 (left) –1 (right) –2 (center) If you want the user to input information, you need a text box

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 6 McGraw-Hill/Irwin Frames Frames are containers for option buttons and check boxes, and are also used to format the appearance of a form Frames establish the mutually exclusive nature of option buttons: Frame Option buttons

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 7 McGraw-Hill/Irwin Check Boxes Select or deselect Yes/No options Default property is.Value Example: chkPrint.Value = 0 (no) 0 = no, 1 = yes (checked), 2=disabled check box

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 8 McGraw-Hill/Irwin Option Buttons Used for mutually exclusive choices such as color choices or Print All, Print Selection, or Print One Page Default property is.Value (0 or 1) Names: optBlue, optFontSize Option buttons

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 9 McGraw-Hill/Irwin Cautions with frames and buttons or boxes Frames are often used to group option buttons or check boxes. Draw the frame(s) first. Be sure to select the desired object’s tool with one click, and then drag and drop to draw the object inside the frame. Do not double click. That places the object in the form’s group. Do not just double click and then drag the object inside the frame. The object still “belongs”to the form.

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 10 McGraw-Hill/Irwin Images An image holds a picture (not an OLE object) Properties: –.Picture (the file name of an image to display) –.Stretch (picture fills control) –.Visible (true/false makes it appear/disappear) Example: imgFlag.Visible = False Let’s do it, See Feedback 2.1. Put your picture onto your Hello World form, just above, or to the left of your name.

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 11 McGraw-Hill/Irwin Shape Control Shape control places rectangles, squares, ovals, circles, or other shapes on a form Shape is determined by.Shape property Shape property value

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 12 McGraw-Hill/Irwin Line Control Draw lines on a form to separate elements Name example: linLogo A Line has very few properties: –BorderStyle –BorderWidth –BorderColor

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 13 McGraw-Hill/Irwin Working with Multiple Controls Selecting multiple controls Deselecting a group of controls Moving controls as a group Setting properties for multiple controls Aligning controls Read about these tricks on pages Learning this can make your VB programming life much easier

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 14 McGraw-Hill/Irwin Designing Your Applications for User Convenience Designing the user interface (gray is good!) Defining keyboard access keys (Exit) –Use Windows-standard keys, when possible –Use x for Exit, S for Save –Type an ampersand (&) in front of the character you want for the access key E&xit for Exit –The user can then use Alt + x for exit, etc. –Do not give two controls the same access key!

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 15 McGraw-Hill/Irwin Default and Cancel Properties Setting command button Default and Cancel properties.Default = True or False.Cancel = True or False Why? A keyboard user can then use the Enter or Esc keys to accomplish the next logical task Example: OK and Cancel buttons Or, Make one of your command buttons the default button for quick calculations.

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 16 McGraw-Hill/Irwin Tab Order Property for Controls Setting the tab order property of controls –TabStop property (.Enabled = yes) Not all controls have this –TabIndex property (a value beginning at 0) Program sets focus on control with lowest TabIndex One control always has the focus –A light dotted line around the control, or the insertion point in a text box If you want to Tab in different sequence, or if you add objects later, you may need to adjust the TabIndex

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 17 McGraw-Hill/Irwin Coding for the controls Very important section – read pages –Resetting the focus –Setting option buttons/check boxes value properties –Changing the font –Properties of controls –Changing multiple properties of a control –Continuing program lines Do Feedback 2.2

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 18 McGraw-Hill/Irwin Controls' Default Properties Each control has a default property A default property is the implied property for the object if you omit it following the object: –txtAddress = "1234 Somewhere Street" –chkPrint = True –lstChoice(index) = "14“ One way to discover what the default property is for a control is to put one on a form, and then note which property is highlighted.

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 19 McGraw-Hill/Irwin Programming Hints Check the tab order of an application Use the value property of a check box or option button to set other true/false properties. Ctrl-click a tool to repeatedly use tool Create an option button inside its frame Label controls are “read only” messages Text controls are input/output controls

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 20 McGraw-Hill/Irwin Review Questions - 1 of 2 1. You can display program output in a text box or a label. When should you use a text box? When should you use a label? 2. How does the behavior of option buttons differ from the behavior of check boxes? 3. If you want two groups of option buttons on a form, how can you make the groups operate independently? 4. Explain how to make a graphic appear in an image control. 5. Describe how to select several labels and set them all to 12-point font size in on operation [at design time]. 6. What is the purpose of keyboard access keys? How can you define them in your project? How do they operate at run time? 7. Explain the purpose of the Default and Cancel command button properties. 8. What is the focus? How can you control which object has the focus?

Programming in Visual Basic 6.0 Update Edition © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 21 McGraw-Hill/Irwin Review Questions - 2 of 2 9. How do you force the insertion point appear in a particular text box that may not have the lowest tabindex value? 10. Write the statement to force the focus to be on txtFirstName on a form. 11. What Basic statements will clear the current contents of a text box and a label? 12. Explain how to change a label's Caption to italic at design time and at run time. 13. How are the With and End statements used? Give an example. 14. What is concatenation and when would it be useful? 15. Explain how to continue a very long Basic statement onto another line. 16. What is the default property of a control? Give an example.