Tutorial 61 List Box Control Can be used to display a set of choices from which the user can select only one You also can create multi-selection list boxes.

Slides:



Advertisements
Similar presentations
TUTORIAL 1 Getting Started with Excel
Advertisements

Using Macros and Visual Basic for Applications (VBA) with Excel
Excel Tutorial 1 Getting Started with Excel
Objectives 1.Identify the functions of a spreadsheet 2.Identify how spreadsheets can be used. 3.Explain the difference in columns and rows. 4.Locate specific.
Chapter 2: Designing Applications
XP New Perspectives on Microsoft Access 2002 Tutorial 61 Microsoft Access 2002 Tutorial 6 – Creating Custom Reports.
1 Introduction to Word Chapter 3 Lecture Outline.
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
Chapter 9: Sequential Access Files and Printing
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Using the Visual Basic Editor Visual Basic for Applications 1.
Copyright © 2001 by Wiley. All rights reserved. Chapter 8: Security, Menus, and Files Security Menu Systems Creating a Memo Editor Using the Clipboard.
Entering Data in Excel. Entering numbers, text, a date, or a time n 1Click the cell where you want to enter data. n 2Type the data and press ENTER or.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
© 2002 ComputerPREP, Inc. All rights reserved. Word 2000: Forms, Merges, and Macros.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Ten String Manipulation and Menus.
Chapter 8: String Manipulation
Programming with Microsoft Visual Basic th Edition
Lesson 1 – Microsoft Excel The goal of this lesson is for students to successfully explore and describe the Excel window and to create a new worksheet.
BIM313 – Advanced Programming Simple Controls 1. Contents Traditional Controls – Labels, Text Boxes, Buttons, Check Boxes, List Boxes, Combo Boxes Advanced.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Interest Calculator Application Introducing the For...Next Repetition Statements.
Tutorial 1: An Introduction to Visual Basic.NET1 Tutorial 1 An Introduction to Visual Basic.NET.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
IC 3 BASICS, Internet and Computing Core Certification Key Applications Lesson 10 Creating and Formatting an Excel Worksheet.
Chapter 3: Using GUI Objects and the Visual Studio IDE.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Working with Numeric Variables (Unit 6) Visual Basic for Applications.
Numeric Variables Visual Basic for Applications 6.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
XP 1 Microsoft Word 2002 Tutorial 1 – Creating a Document.
® Microsoft Office 2010 Excel Tutorial 1: Getting Started with Excel.
Windows Tutorial Common Objects ACOS: 1, 4. Using the Taskbar 1. Using the taskbar, you can switch between open programs and between open documents within.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Lesson 11: Looking at Files and Folders what a file or folder is on the computer how to recognize a file or folder on the desktop how to recognize the.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
Basic Editing Lesson 2.
© 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 15 Advanced Tables.
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
Chapter 8: Manipulating Strings
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
An Introduction to Programming with C++ Sixth Edition Chapter 14 Sequential Access Files.
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.
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined.
1 Excel Lesson 1 Microsoft Excel Basics Microsoft Office 2010 Pasewark & Pasewark.
Lesson 6 Formatting Cells and Ranges. Objectives:  Insert and delete cells  Manually format cell contents  Copy cell formatting with the Format Painter.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Ten Structures and Sequential Access Files.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Introduction to Files in VB Chapter 9.1, 9.3. Overview u Data Files  random access  sequential u Working with sequential files  open, read, write,
An Introduction to Programming with C++ Sixth Edition Chapter 13 Strings.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
Tutorial 81 Field, Record, Data File Field - a single item of information about a person, place, or thing Record - a group of related fields that contain.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
MS WORD INFORMATION TECHNOLOGY MANAGEMENT SERVICE Training & Research Division.
Computer Fundamentals Muhammadamin Daneshwar And Masoud Aras Computer Engineering Department Soran University Lecture 6.
Menu & Clipboard Menu Cut / Copy / Paste. Menus Created in the Menu Editor Can contain menu titles, menu items, separator bars, submenu titles, and submenu.
Chapter 14: Sequential Access Files
Variables and Arithmetic Operations
Microsoft Excel 2007 Introduction to Spreadsheet Programs
CIS16 Application Development and Programming using Visual Basic.net
Presentation transcript:

Tutorial 61 List Box Control Can be used to display a set of choices from which the user can select only one You also can create multi-selection list boxes from which the user can select zero or more choices (See Lesson A’s Discovery Exercise 11)

Tutorial 62 GUI Standards for List Boxes List boxes should contain a minimum of three selections You should display a minimum of three selections and a maximum of eight selections at a time Use a label control to provide keyboard access to the list box

Tutorial 63 AddItem Method Used to add items to a list box Syntax control.AddItem item item is the expression you want displayed, and it can be either numeric or string if item is a literal string constant, then it must be enclosed in quotation marks

Tutorial 64 Arrangement of List Box Items By use, with the most used entries appearing first in the list Sorted in ascending order either alphabetically, numerically, or chronologically

Tutorial 65 Sorted Property Can be set to either the Boolean value True or the Boolean value False If set the True, the list box items will be sorted in ascending order If set to False, the list box items will appear in the order in which they were entered

Tutorial 66 ListIndex Property You can use the ListIndex property to refer to an item in the list box The first item in a list box has a ListIndex value of 0 If no items are selected in the list box, the ListIndex property has a value of -1

Tutorial 67 Default Item It is customary to select a default item in a single-selection list box when the interface first appears The default item should be either the most used selection or the first selection in the list lstName.ListIndex = 0 will select the first item in the lstName list box A default selection typically is not made in a multi-selection list box

Tutorial 68 Program Files vs Data Files A program file contains the instructions that both create the user interface and tell the objects how to respond to events A data file is a collection of information composed of fields and records

Tutorial 69 Fields, Records, and Data Files A field is a single item of information about a person, place, or thing A record is a group of related fields that contain all of the necessary data about a specific person, place, or thing A data file is a collection of related records

Tutorial 610 Sequential Access Data Files Similar to a cassette tape in that each record in the file is both stored and retrieved in consecutive order Advantage: easy to create Disadvantage: you can process the records only in the order in which they were entered Use for small files, files consisting only of text, or files that will always be accessed in sequential order

Tutorial 611 Open Statement Open pathname For mode As # filenumber pathname is the name of the file you want to open; it should include the drive letter and path, and it must be enclosed in quotation marks (unless it is stored in a String variable mode can be either Input, Output, or Append filenumber is a number that you assign to the file, and it must be an integer between 1 and 511, inclusive

Tutorial 612 Sequential Access File Modes Input - you open a file for Input when you want to read the file Output - you open a file for Output when you want to create a new file and then write data to it Append - you open a file for Append when you want to add data to the end of an existing file

Tutorial 613 Record Pointer When you open a file for Input, the record pointer is positioned at the beginning of the file, immediately before the first record When you open a file for Output, the record pointer is positioned at the beginning of the empty file When you open a file for Append, the record pointer is positioned immediately after the last record in the file

Tutorial 614 Write # Statement Write # filenumber, [outputlist] filenumber is the number used in the Open statement to open the file outputlist is one or more numeric or string expressions, separated by commas

Tutorial 615 Close Statement Close [# filenumber] filenumber is the number used in the Open statement to open the file A Close statement with no filenumber closes all open files

Tutorial 616 Verifying the Contents of a Sequential Access File Use a basic word processor or text editor Each line in the sequential access file represents a record Fields in the record are separated by commas String fields are enclosed in quotation marks

Tutorial 617 Sequential Access File

Tutorial 618 EOF Function EOF(filenumber) filenumber is the number used in the Open statement to open the file EOF stands for “end of file” returns the Boolean value True if the record pointer is at the end of the file (after the last record); otherwise it returns the Boolean value False Do While Not EOF(1) Do Until EOF(1)

Tutorial 619 Input # Statement Input # filenumber, variablelist filenumber is the number used in the Open statement to open the file variablelist is one or more numeric or string variables, separated by commas Each variable in the variablelist is associated with a field in the record The number, data type, and order of the variables in the variablelist must match the fields in the record

Tutorial 620 Print Method Print [outputlist] - prints to the form Printer.Print [outputlist] prints to the printer Printer is a keyword that refers to the Printer object Outputlist is the expression or list of expressions you want to print; if outputlist is omitted, the Print method prints a blank line

Tutorial 621 Print Method Separators Comma - tells Visual Basic to tab to the next print zone before printing the next character Semicolon - tells Visual Basic to move to the next print position before printing the next character You also can use the spacebar in place of the semicolon

Tutorial 622 Printing Strings and Numbers When you print a string literal constant, Visual Basic prints only the characters included within the quotation marks Visual Basic prints positive numbers with both a leading and a trailing space Visual Basic prints negative numbers with a leading minus sign and a trailing space

Tutorial 623 Spc and Tab Functions Spc(number) Number represents the number of spaces to insert before displaying or printing the next item in the outputlist Tab(number) Number represents the column number, or print position, to which you want Visual Basic to tab before printing the next item in the outputlist

Tutorial 624 Fixed-spaced vs Proportionally-spaced Fonts Fixed-spaced fonts Also called monospaced fonts Use the same amount of space to print each character Courier New is a fixed-spaced font Proportionally-spaced fonts Use varying amounts of space to print characters MS Sans Serif is a proportionally-spaced font

Tutorial 625 Right-justifying and Aligning Numbers by Decimal Point Use the Format function to ensure that each number in the column has the same number of digits to the right of the decimal point Use the RSet statement to right-align the numbers within the column

Tutorial 626 Format Function Format(expression, format) expression specifies the number, date, time, or string whose appearance you want to format format is either the name of a predefined Visual Basic format or a string containing special symbols that tell Visual Basic how you want the expression displayed

Tutorial 627 RSet Statement RSet stringvariable = string stringvariable is the name of a fixed-length String variable A fixed-length String variable is one whose maximum length is defined when the variable is created Dim variablename As String * number string is the expression you want right-aligned

Tutorial 628 Printer Spacing Chart Reports should have a report title and column headings Detail lines show the information used to calculate the subtotals and grand total 999 indicates numbers having a maximum of 3 digits XXX indicates a string having a maximum of 3 characters Include an “End of report” message

Tutorial 629 MultiLine Property Controls how many lines a text box can both accept and display Can be set to either True or False (default) Visual Basic automatically wraps the text in a multiline box if the text extends beyond the size of the box

Tutorial 630 ScrollBars Property Specifies whether a text box has no scroll bars, horizontal scroll bars, vertical scroll bars, or both horizontal and vertical scroll bars Visual Basic ignores the value in the ScrollBars property unless the MultiLine property is set to True

Tutorial 631 Sizing a Control Along with the Form Set the control’s Height and Width properties to the form’s ScaleHeight and ScaleWidth properties Enter the sizing code in the form’s Resize event, which occurs when the form is first displayed on the screen and when the user changes the size of the form either by minimizing, maximizing, or restoring it, or by using the form’s borders to resize it

Tutorial 632 Menus Created in the Menu Editor Can contain menu titles, menu items, separator bars, submenu titles, and submenu items To avoid confusion, it is best to use one level of menus

Tutorial 633 Menu Elements in User Interface

Tutorial 634 Menu Elements in Menu Editor

Tutorial 635 Access Keys Assign to each menu title and each menu item Must be unique within a menu Menu titles are accessed by pressing the Alt key and the access key Menu items are accessed by pressing the access key when the menu is open

Tutorial 636 Shortcut Keys Assign to commonly used menu commands Displayed to the right of the menu item Can be used only when the menu is closed

Tutorial 637 More on Menu Controls You must provide a name and a caption for each menu control Each menu title and each menu item is considered a separate control and it can have its own code A menu control can recognize only the Click event

Tutorial 638 Separator Bar A separator bar is a horizontal line used to separate two groups of menu items Created by entering a hyphen in the menu control’s Caption property Even separator bars must have a name

Tutorial 639 Clipboard Object Provides access to the Windows clipboard Allows you to include cut, copy, and paste capabilities in your application

Tutorial 640 Methods of the Clipboard Object SetText method sends text to the clipboard Clipboard.SetText data GetText() method retrieves text from the clipboard Clipboard.GetText() Clear method clears the contents of the clipboard object.Clear

Tutorial 641 SelText Property When a user selects text in a text box, Visual Basic records the text in the text box’s SelText property This property contains a zero-length string if no text is selected You also can use the SelLength property to determine if any text is selected in the text box

Tutorial 642

Tutorial 643 Edit Menu Click Event

Tutorial 644 Copy Command Click Event

Tutorial 645 Cut Command Click Event

Tutorial 646 Paste Command Click Event

Tutorial 647 String Manipulation Functions Left(string, length) returns the leftmost length characters in the string Right(string, length) returns the rightmost length characters in the string Mid(string, start[, length]) returns length characters from string, beginning with start

Tutorial 648 Instr Function Instr(start, string1, string2[,compare] start is a numeric expression that sets the starting position for the search string1 is the string expression being searched string2 is the string expression being sought compare is either 0 (default; case-sensitive) or 1 (case-insensitive) returns the starting position of string2 within string1

Tutorial 649 Debugging Technique Visual Basic’s Edit menu provides two commands that you can use to edit the code in an application quickly. These commands are Find and Replace