Introducing More Controls Text boxCheck box Option button Command button frame image.

Slides:



Advertisements
Similar presentations
Getting Started with PowerPoint
Advertisements

Objectives Build and modify an organization chart.
Working with Intrinsic Controls and ActiveX Controls
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
Chapter 3 Creating a Business Letter with a Letterhead and Table
Using Macros and Visual Basic for Applications (VBA) with Excel
Intro to Microsoft PowerPoint 2010 Public Computer Center, Moore Memorial Library, Greene, NY.
PowerPoint Practice Exercise
Chapter 3.1 Controls Programming In Visual Basic.NET.
Chapter 2 More Controls Programming In Visual Basic.NET.
PowerPoint. Getting Started with PowerPoint Objectives Start PowerPoint and open presentations Explore toolbars and menus Use the Office Assistant Work.
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.
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.
Chapter 31 Visual Basic Controls A Form is a windows-style screen displayed by Visual Basic programs. In a form, a programmer can create objects in a form.
IBA First Semester Exam Review. Microsoft Office 2010 Basics and the Internet 1.The tabs on the Ribbon organize the commands into related tasks. The commands.
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.
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
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)
MS-Access XP Lesson 5. Creating a Query with Expression Builder Eg. Consider the following table. Table Name: Overtime Fields & Data types: Emp No (Number),
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Chapter 21 Creating Applications with Visual Basic.NET Chapter 2.
Chapter 2 More Controls 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.
Chapter 2 - More Controls More controls – Text boxes - used for user input – Frames - containers to group items – check boxes - user select an option -
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.
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Chapter Two Designing Applications Programming with Microsoft Visual Basic th Edition.
Visual Basic.NET BASICS Lesson 3 Events and Code.
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.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
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.
Introduction to Microsoft publisher
CS130 Project 1 A simple VB application ("project" or program): user enters amount of sales then clicks the "Calculate button", the application displays.
PowerPoint Practice Exercise 1 1.Save this file in your AV-TECH Folder as PowerPoint Practice Exercise 1. 2.Open this file in PowerPoint. 3.Edit each slide.
More Controls and Their Properties Part 4 dbg --- TextBox, CheckBox, RadioButton, GroupBox, ToolTips,
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
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.
PowerPoint Practice Exercise 1.Save this file on your computer. 2.Open this file in PowerPoint 3.Edit each slide according to the instructions provided.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
COMPUTER PROGRAMMING I 3.02 Apply Properties Associated with the Controls.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
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.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
COMPUTER PROGRAMMING I 3.01 Apply Controls Associated With Visual Studio Form.
 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.
Microsoft Visual Basic 2010 CHAPTER FOUR Variables and Arithmetic Operations.
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 1: An Introduction to Visual Basic 2015
Variables and Arithmetic Operations
Variables and Arithmetic Operations
Visual Basic Objects Controls
Brief description on how to navigate within this presentation (ppt)
Programming In Visual Basic.NET
Chapter 2 User Interface Design
Presentation transcript:

Introducing More Controls Text boxCheck box Option button Command button frame image

Text Boxes Used primarily for user input It holds the value input by the user as characters Three letter prefix is txt Use the Text property of text boxes in program code to assign an input value Example: txtMessage.Text=“Enter your name here” Alignment property changes the alignment of text but you must also set the Multiline property to True for it to be effective Set at design time only 0-Left Justify;1-Right Justify;2-Center

Frames used as containers for other controls and to group like items on a form. Three letter prefix is fra Set the Frame Caption property to the words that you wish to appear at the top edge of the frame

Check Boxes allows the user to make choices any number of the boxes may be selected or deselected Three letter prefix is chk Value property is set to 0 if unchecked, 1 if checked and 2 if grey or disabled Use the Value property in your event procedure code to determine the user’s selections Caption property is used to specify text next to the box

Option buttons only one can be selected Generally place several options in a frame to form a group Create frame first, select object and use the crosshair to draw the option Doubleclicking the control on the toolbox automatically places it on form Once on the form, it becomes part of the form group even if you later drag it into a frame Value Property is True if option is selected and False if not Caption property is used to specify text next to the box Three letter prefix is opt

Images A control which will contain a graphic The control is first placed on the form and then the Picture property provides a Load option to include the desired graphics file File extension of.bmp,.gif,.jpg among others Stretch property = True causes the picture to fill the control Visible property = False causes the picture to be invisible

Setting a Border and style The Appearance property of many controls can be set to 0 - Flat or 1 - 3D To make a label or image 3 dimensional first provide it with a border

The Shape and Line Control the shape tool in the VB toolbox (not drawing toolbox) provides the ability to put rectangles, squares, ovals and circles on a form Type of shape is assigned through the Shape property 0-Rectangle, 1-Square, 2-Oval, 3-Circle, 4-Rounded Rectangle, 5 - Rounded Square 3 letter prefix is shp Use the line tool on the VB toolbox to provide for lines on a form Change the properties for thickness and color using Borderwidth and Color 3 letter prefix is lin

Working with Multiple Controls You can select multiple controls and treat them as a group, including setting common properties at once, moving them, or aligning them. The properties windows display properties common to the group after the group has been created

Combining controls into a group To select Drag a selection box around the controls to group or/ Ctrl or Shift select each one To deselect Click anywhere on the form not on the control

To align and resize a group of controls Use the format option on the menu and select the Align or Make Same Size submenus Measured in Twips – 1/1,440 of an inch a control that that has a width of 1,440 twips is an inch wide

Standards for Designing the User Interface Make your programs easier to use by following Windows standard guidelines for colors, control size and placement, access keys, default and cancel buttons, and tab order Windows are primarily grey White text boxes Grey background for labels If a message will be displayed or a calculation results – border the label If only a caption on the screen – no border

Defining Keyboard Access Keys Define keyboard access keys by including an ampersand in the caption of command buttons, option buttons, and check boxes etc. Examples: &OK for OK or E&xit for Exit Activated by depressing Alt+O or Alt+x Try to follow the Windows defaults to avoid confusion

Setting the Default and Cancel Properties of Command Buttons Set the Default property of one command button to True user can press Enter to select this button Set the Cancel property to True for one command button this button will be selected when the user presses the Esc key.

Setting the Focus and Tab Order for Controls One control on a a form always has the focus Focus is a light dotted line for command buttons and option buttons Focus is the insertion point for text boxes image controls and labels do not have a focus The focus moves from control to control as the user presses the Tab key. The sequence for tabbing is determined by the TabIndex properties of the controls. Assigned by VB as you begin to enter controls Starts at 0 When program begins running, focus is on control with TabIndex 0 Although labels do not have a focus…they do have a tabindex If you use a & in the caption of a label, the focus will move to the first TabIndex following the label when the access key is activated,

Setting the Form’s Location on the Screen The form will appear in the upper left hand corner of the screen by default To change – drag form in Form/Layout window or/ StartupPosition Property of Form set to 0-Left, 1-Right,2-Center

Creating ToolTips Set the ToolTipText property of a control to make a ToolTip appear when the user pauses the mouse pointer over the control.

Coding for the Controls controls can be changed at run time by using VB code in the event procedures Text boxes and labels can be cleared The focus can be set Option buttons and check boxes can be preset Font and colors can be changed Multiple properties of a group of controls can be set

Clearing Text Boxes and Labels Set the property to empty string or null string defined by “” txtName.txt =“” lblAddress.Caption=“”

Resetting the Focus To reset the focus, use Object.Method Example: txtName.SetFocus

Setting the Value Property of Option Buttons and Check Boxes To set a default value to an option button or check box, use the Value Property Example: chkBold.Value = 1 means box is checked Example: chkBold.Value = 0 box is unchecked (Remember 2 is greyed or dimmed) Example: optRed.Value=True means button is selected

Changing the Font Properties of Controls To change font attributes of a text box or a label, use the Font property of the control. The Font property refers to a Font object, with properties for bold, italic, underline, size, etc. Example: txtName.Font.Bold = True Example: txtName.Font.Size = 14 Example: txtName.Font.Underline= True

Changing the Color of Text Change the color of text in a control by changing the ForeColor property txtMessage.ForeColor = vbGreen changes the text to Green Change the color around the text by changing the BackColor property txtMessage.BackColor = vbWhite changes the area around the text to White Several default Visual Basic color constants vbBlack, vbWhite, vbRed, vbGreen, vbYellow, vbBlue, vbMagenta, vbCyan

Changing Multiple Properties of a single Control during Run Time Instead of : txtTitle.Visible=True txtTitle.Font.Bold = True txtTitle.ForeColor = vbRed txtTitle.SetFocus Use a With block which is actually more efficient in terms of execution time With txtTitle.Visible=True.Font.Bold = True.ForeColor = vbRed.SetFocus End With

Concatenating Text Joining two strings of text is called concatenation and is accomplished by placing & between the two elements. A space must precede and follow the & Example: lblMessage.Caption = “Your name is: “ & txtName.Text

Continuing Long Program Lines Use a space and an underscore to continue a long statement on another line. You may indent the next line You may not use this line continuation character in the middle of a literal or split the name of an object or property Examples: lblGreetings.Caption = “Greetings “ & txtName.Text & “:” & _ “You have been selected to win a free prize. “ & _ “Just send us $100 for postage and handling”

Using the Default Property of a Control Using the default property of a control allows you to refer to an object without naming the property Example: A text box the default property is Text hence you can write either txtCompany.Text = “ABC” or/ txtCompany = “ABC” chkHours.Value = 1 or/ chkHours =1 Table 2.1 in text provides a complete list