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.

Slides:



Advertisements
Similar presentations
Getting Started with PowerPoint
Advertisements

Chapter 1: An Introduction to Visual Basic 2012
Using Macros and Visual Basic for Applications (VBA) with Excel
Intro to Microsoft PowerPoint 2010 Public Computer Center, Moore Memorial Library, Greene, NY.
Chapter 3.1 Controls Programming In Visual Basic.NET.
Chapter 2 More Controls Programming In Visual Basic.NET.
Module Word 2007 Basics Learning Outcomes Learn basic Word 2007 commands. Create, save, and print documents. Apply text, paragraph, and page formats. Review.
After attending this workshop, students should be able to complete the following tasks involving MS Word:
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.
1.
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 More Controls Programming In Visual Basic.NET.
Microsoft Visual Basic 2010: Reloaded Fourth Edition
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
ABC’s of PowerPoint (Office 2007) Part 1: Basic Vocabulary Part 2: Cursors Part 3: Insert Your Text Part 4: Insert Your Pictures Part 5: Basic Tools &
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
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.
BoardMaker Ver 6 Creating Interactive Activities for the Classroom.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
Chapter 3 Working with Symbols and Interactivity.
05/09/ Introducing Visual Basic Sequence Programming.
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
Introduction to Programming Using Visual Basic 6.0
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
COMMON APPLICATION FUNCTIONS Presentation. Bullets  Symbols used to organize data into a list.  This  Is  An  Example  Of  A  Bullet  List.
Visual Basic 2005 CHAPTER 2 Program and Graphical User Interface Design.
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.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Chapter Two Designing Applications Programming with Microsoft Visual Basic th Edition.
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.
Chapter Two Creating a First Project in Visual Basic.
How to get started with Excel VBA. We need to enable programming in Excel  the “Developer menu”
3.9 to  Also refer to as Program  Contains set of instructions that tells the computer how to perform specific task.  Each line of code is referred.
More Controls and Their Properties Part 4 dbg --- TextBox, CheckBox, RadioButton, GroupBox, ToolTips,
CSC115 Introduction to Computer Programming Zhen Jiang Dept. of Computer Science West Chester University West Chester, PA 19383
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.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.
More Form Tools Combo Box (displays a list) Check Box (yes/no) Frame (groups option buttons) Option Button (exclusive choice) Ref Edit (user selects cells)
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
BBT 10 Visual Basic 03 Enrichment. Tip Before creating any files for your project, first create a new folder Save all of your files in the folder Pieces.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 2 Creating Applications with Visual Basic.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Introduction to Programming Using Visual Basic 6.0 Cheryl Klimack
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
CIS 205—Web Design & Development Flash Chapter 3 Working with Symbols and Interactivity.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
MS WORD INFORMATION TECHNOLOGY MANAGEMENT SERVICE Training & Research Division.
Chapter 2 More Controls Programming In C Shap. © Controls in the Toolbox.
Program and Graphical User Interface Design
Visual Basic Objects Controls
Programming In Visual Basic.NET
Chapter 2 User Interface Design
Presentation transcript:

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 formatter Text boxes The white box next to “Your Name” The white box next to the words “Message” Frame The box enclosing the Color buttons The box enclosing the Style buttons Option buttonThe buttons labeled Red, Green, Blue, Black. Check boxes The boxes labeled Bold, Italic, and Underline. Image The picture of the CD at the lower left. More Controls

Chapter 2 P. 2 Labels The label containing “Your Name” The box containing “Message” The two blank boxes at the bottom of the screen The label containing “Click Me” Command buttons - Display, Clear, Print, Exit Create the form in the book Create the labels Create the label containing “Your Name” - you need not change the Name - in Properties change Caption to “Your Name” Create the label containing “Message” - you need not change the Name - in Properties change Caption to “Message” Create one blank label at the bottom center of the form - in Properties change Name to lblMessage - in Properties delete Caption

Chapter 2 P. 3 - create the label containing “Click Me” - you need not change the Name - in Properties change Caption to “Click Me” Note: You need to change the name of a label if you refer to the label in the code; i.e., if you place some message in the label. Create the text boxes - create text box by “Name” (user types a name at run time) - create a Text box next to “Your Name” - in Properties change Name to txtName - in Properties delete the Text - create text box by “Message” (user types a message at run time) - create a Text box next to “Message” - in Properties change Name to txtMessage - in Properties delete the Text

Chapter 2 P. 4 - center the message in this box (this can be done only at design time) - in Properties set Multiline to True - in Properties set Alignment to 2-Center Note: The Name of a text box begins with txt. Note: A label box has a Name and Caption. A text box has a Name and Text. Example You can write lblMessage.Caption = txtMessage.Text in the code. This places the message in the second text box into the label box. (This will go into the code for the Display button.) Create the frames (for the Color and Style) A frame is a control which contains several other controls.

Chapter 2 P. 5 - create the Color frame - in the Toolbox use the Frame tool to draw a frame - in Properties change Name to fraColor - in Properties change Caption to Color - create the Style frame - in the Toolbox use the Frame tool to draw a frame - in Properties change Name to fraStyle - in Properties change Caption to Style Create the check boxes for Style - create the check box for Bold - in the Toolbox use the Check box tool to draw a check box within the Style frame - in Properties change Name to chkBold - in Properties change Caption to Bold - create the check boxes for Italic and Underline

Chapter 2 P. 6 Note: you must draw the check boxes and option buttons inside the appropriate frame; you can not create them and then drag them into the frame. Place the Image onto the form The VB folder contains several Images, which you can copy into your form. Simply use Copy and Paste. - in the Toolbox use the Image tool to draw a control for the Image - in Properties change Name to imgCDROM - copy in the picture - in Properties select Picture (Fig ) - find the picture you want (the CD-ROM) - select Program Files, Dev Studio, VB, Graphics, Icons, Computer, CDROM

Chapter 2 P. 7 - double-click on the image - copy in the other picture - create a new Image frame - copy the other image into the frame - when both pictures are on the frame, drag one image frame on top of the other Note: copying one picture on top of another will hide one of the pictures. In the code we will see how to show each of the pictures alternately. - set other properties - enlarge the image - resize the Image control - in Properties set Stretch to True - hide the picture - set Visible to False (in the code)

Chapter 2 P. 8 - giving a 3-dimensional appearance to controls - in Properties select Borderstyle to 1 - 3D - in Properties select Appearance and 1-3D Working with multiple controls Select multiple controls “Draw” a box around the controls with the cursor or hold the Shift key and click on the controls Deselecting a group of controls Click outside the selected group Moving controls as a group Click and drag Setting properties for multiple controls Align controls

Chapter 2 P. 9 Setting properties for user convenience Defining keyboard access keys (for command buttons, option buttons, and check boxes) - in Properties put the & symbol before a letter in the Caption for a command button - the letter will appear underlined on the form - the user can hit Alt and that letter to activate the command Example In the message formatter there is an underline under R in the word Red. If the user hits Alt R, then the message appears red. Setting the default and cancel properties Default- in Properties set Default to True - user activates this button with Return Cancel- in Properties set Cancel to True - user activates this button with Esc

Chapter 2 P. 10 Set the tab order for controls - in Properties select Tabindex - type in a number indicating the order in which you want the control to be chosen when the program runs - Example In Properties set Tabindex to 4. When you run the program, if you hit the Tab key, this control will be the fourth one to be activated. Coding for the controls Clearing text boxes and labels (in code) - text box - set the Text to “ “ - Example txtName.text= “ “ -label - set the Caption to “ “ - Example lblMessage.Caption = “ “

Chapter 2 P. 11 Resetting the focus Definition The focus is the control which holds the cursor when the program starts. Example To set the focus in the Name text box, the command is txtName.SetFocus. (In the Text formatter, this command occurs in the code for the Clear control.) Setting the value properties of option buttons and check boxes (in code) Example Check the Red option button optRed.Value=True Example Check the Bold check box chkBold.Value = 1 OR chkBold.Value = Checked Example Uncheck the Bold check box chkBold.Value = 0 OR chkBold.Value = Unchecked

Chapter 2 P. 12 Changing the font properties of controls - before running the program - in Properties select Font - in the dialogue box check the desired properties - in code - assign the appropriate font property and value -Example txtName.Font.Bold = True lblMessage.Font.Size = 12 lblTitle.Font.Italic = True Changing the color of text (in code) - set the ForeColor to one of the color constants vbBlack, vbRed, etc. (see P. 55)

Chapter 2 P. 13 Changing multiple properties of a control Example Book P. 56 The codetxtTitle.Visible = True txtTitle.ForeColor = vbWhite txtTitle.Font.Bold = True txtTitle.Font.Italic = True txtTitle.SetFocus can be rewritten asWith txtTitle.Visible = True.ForeColor = vbWhite End With Concatenating text Use the &symbol Example lblMessage.Caption = “Hello” & “ “ & txtMessage.text

Chapter 2 P. 14 Continuing program lines Use &_ Example lblMessage.Caption = “If you return the winning number,” &_ txtName.text &”, you will be rich!” Using the value of controls Example lblMessage.Caption = txtName.text

Chapter 2 P. 15 Objects, Methods, and Properties Option button Red Properties NameoptRed CaptionRed > Value True Method optRed_Click () User

Chapter 2 P. 16 Check box Bold Properties NamechkBold CaptionBold > Value Checked MethodchkBold_Click () User

Chapter 2 P. 17 Command button Display Properties NamecmdDisplay Caption&Display Method > cmdDisplay User

Chapter 2 P. 18 Label Your name Properties NamelblName CaptionYour Name User <

Chapter 2 P. 19 Text box Properties NametxtName > Text User