Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab9 Control Array Print Method Printing VB Output.

Slides:



Advertisements
Similar presentations
1.
Advertisements

Database Basics. What is Access? Database management system Computer-based equivalent of a manual database Makes it easy to organize and update information.
Modeling using VBA. Covered materials -Userforms -Controls -Module -Procedures & Functions -Variables -Scope.
1 Visual Basic Programming II Lecture 3 MIS233 Instructor – Larry Langellier.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 14 – Student Grades Application: Introducing.
VBA Modules, Functions, Variables, and Constants
Arrays  Writing a program that uses a large amount of information.  Such as a list of 100 elements.  It is not practical to declare.
Using String Functions Left(str, nchars) - extract left nchars Right(str, nchars) - extract right nchars Mid(str,start,[nchars]) - get middle chars.
Arrays-Part 1. Objectives Declare and initialize a one-dimensional array Store data in a one-dimensional array Display the contents of a one-dimensional.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 8 Arrays.
Arrays Array of Controls: several controls, of the same type (Class: a prototype for an object indicating the properties and methods), that have the same.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab10 Interacting with Data (Database Management)
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab3 Check Boxes,Option Buttons Frame Control Frame Control MsgBox, InputBox Functions Day7.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 بسم الله الرحمن الرحيم Palestine Polytechnic University College of Administrative science and.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab2 Managing Controls.
1 Chapter 7 Arrays. 2 Outline and Objective In this chapter we will Learn about arrays One-dimensional arrays Two-dimensional arrays Learn about searching.
Arrays Array of Controls: several controls, of the same type (Class: a prototype for an object indicating the properties and methods), that have the same.
Lec4 P 1 CP2030 Visual Basic For C++ Programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 4 Back To Index v Iteration - Looping v Arrays.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab8 Working with Forms Forms Collection Multiple Forms.
1 Chapter 7 Arrays. 2 Outline and Objective In this chapter we will –Learn about arrays One-dimensional arrays Two-dimensional arrays –Learn about searching.
CSI 101 Spring 2009 Review and Recap of Visual Basic Wednesday, April 29 th.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Chapter 06: Lecture Notes (CSIT 104) 1 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Copyright © 2008 Prentice-Hall. All rights reserved.
IE 212: Computational Methods for Industrial Engineering
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Lists in Python.
Chapter 17: Arrays Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
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.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Chapter 10: Structures and Sequential Access Files
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Arrays and 2D Arrays.  A Variable Array stores a set of variables that each have the same name and are all of the same type.  Member/Element – variable.
Java Script: Arrays (Chapter 11 in [2]). 2 Outline Introduction Introduction Arrays Arrays Declaring and Allocating Arrays Declaring and Allocating Arrays.
1 Chapter 7 – Arrays 7.1 Creating and Using Arrays 7.4 Two-Dimensional Arrays.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Chapter 6 Data Tables and Amortization Tables Exploring Microsoft Office Excel 2007.
Arrays Code: Arrays Controls: Control Arrays, PictureBox, Timer.
‘Tirgul’ # 3 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #3.
Input and Output. Announcements  Exam Next Wednesday –Next Monday: Review session.  Invited talk: –7:30 PM,Tuesday, Oct 28th. –Prof. Katherine Socha.
© Copyright 2013 by Pearson Education, Inc. All Rights Reserved. 1 Chapter 8 Multidimensional Arrays.
Arrays. Overview u General Discussion  Uses  Structure  Declaration u Searching u Control Arrays.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Class Average Application Introducing the Do...Loop While and Do...Loop Until.
CSC 162 Visual Basic I Programming. Array Parameters and Sorting Array Parameters –Entire Arrays –Individual Elements Sorting –Bubble Sort.
Project 1: Using Arrays and Manipulating Strings Essentials for Design JavaScript Level Two Michael Brooks.
Chapter 7 P 1 Lists and Loops List boxes and combo boxes List box - list of items - useful for a list which does not change Combo box - list of items -
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.
6-1 Chapter 6 Working with Arrays in VB.NET. 6-2 Learning Objectives Understand the use of list and table arrays in VB.NET projects and the difference.
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.
With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.
Arrays Chapter 8. Overview u General discussion u Variable arrays u Control arrays u Multi-dimensional variable arrays  Two-dimensional  Three-dimensional.
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Ten Structures and Sequential Access Files.
List Boxes and Combo Boxes Provides a list of items to select from Various styles — choose based on Space available Need to select from an existing list.
CHAPTER EIGHT ARRAYS © Prepared By: Razif Razali1.
1 Chapter 7 Arrays. 2 Outline and Objective In this chapter we will Learn about arrays One-dimensional arrays Two-dimensional arrays Learn about searching.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
B Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Working with PDF and eText Templates.
COM148X1 Interactive Programming Lecture 8. Topics Today Review.
Arrays 1.
Programming Right from the Start with Visual Basic .NET 1/e
Formulas, Functions, and other Useful Features
Dr. Ralph D. Westfall June, 2011
Chapter 7 Arrays.
Creating and Formatting Tables
VISUAL BASIC.
CIS16 Application Development and Programming using Visual Basic.net
Introduction to Computer Programming IT-104
Presentation transcript:

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab9 Control Array Print Method Printing VB Output

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 2 Control Array

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 3 Control Array A group of controls of the same type, Name and event procedure. Each control array element has it’s own properties. Each control array element has it’s own INDEX starting with 0.

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 4 Control Array …[CONT] Creating Control Array: 1- Giving the control the same name as another control. 2- Copying the control and pasting it the same form. Control Array Methods: Count : Shows the number of controls in the array. Lbound : Shows the lower index. Ubound: Shows the upper index

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 5 Control Array …[CONT] Item: Enables accessing an individual element in the control array. Example: Private Sub Command1_Click() Print Text1.Count Print Text1.LBound Print Text1.Ubound Text1.Item(2).Text = "Ahmad" End Sub

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 6 Print Method

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 7 Placing Text on Forms Print Method: This method enables writing on forms directly. Print applies to Forms, Picturebox, Printer object… syntax: FormName.Print Text

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 8 Format with Print Spc() Function: Skip number of spaces (columns) as specified with Spc function. Example: Form1.Print Spc(10); “Hebron” This statements skips 10 spaces before printing the word “Hebron”

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 9 Tab() Function Starts printing at the specified column with the Tab function. Example: Form1.Print Tab(20); “Hebron”; Tab (30) “PPU” This statement print the word “Hebron” starting at column 20, and the word “PPU” at column 30.

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 10 Notes: When the print method ends with semicolon ( ; ): The text is printed and the next text is printed directly at the same line. Form1.Print “Hebron” ; When the print method ends with comma (,): The text is printed and the next text is printed directly in the next position at the same line. When using empty print method: VB prints blank line.

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 11 Positioning the Print Method Properties: ScaleMode: Affects how rows and columns are measured on the form. See Table 11.5/345. CurrentX: Specifies the column. CurrentY: Specifies the row. Example: Form1.ScaleMode=4 Form1.CurrentY=2 : Form1.CurrentX=5 Form1.Print “Hebron” Prints Hebron at line 2 column 5

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 12 How Can you Position printing on the form? Private Function P1(Line, Column) Form1.CurrentY = Line Form1.CurrentX = Column End Function Private Sub Command1_Click() Form1.ScaleMode = 4 Print P1(2, 5); "Hebron" Print P1(3, 5); "PPU" End Sub

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 13 Printing VB Output Day 13 Page 405

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 14 Printer Object The printer object allows the programmer to send text and graphics to a printer. Declaring printer object: Dim PrinterName As Printer Printer Object properties: See Table 13.1 page 407 Copies : The number of copies to print. CurrentX, CurrentY : Set X and Y coordination to the next printed character. Page: returns the current page number.

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 15 Examples on Printer properties pr.CurrentX = 10 pr.CurrentY = 2 pr.Copies = 4 Fomr1.Print pr.Page pr.FontBold = True pr.ScaleMode = 4 'Character

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 16 Printer Methods

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 17 Printer Method Examples Pr.NewPage pr.Print “bkjxvbkll” Form1.PrintFrom

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 18 Lab Training Design a VB project to: Accept Student names in a list, then lock it. Select student name from the list then accept 3 grades (Grade1, Grade2, Grade3) in a related text boxes for each grade. Perform the required validation to each grade.

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 19 Lab Training …. [CONT] Calculate the student average. Sort the student names in ascending order according to their averages. Print the sorted student names and grades and averages on another form End

Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 20 Lab9End