Mark Dixon, SoCCE SOFT 131Page 1 13 – Control Arrays & Container Controls.

Slides:



Advertisements
Similar presentations
Mark Dixon, SoCCE SOFT 131Page 1 15 – Object Oriented Analysis, Design, and Programming.
Advertisements

Mark Dixon, SoCCE SOFT 131Page 1 22 – Object Oriented Analysis, Design, and Programming.
Mark Dixon Page 1 04 – Database Design: Forms. Mark Dixon Page 2 Session Aims & Objectives Aims –To allow easier data entry using forms Objectives, by.
Mark Dixon, SoCCE SOFT 131Page 1 09 – Procedures.
Mark Dixon, SoCCE SOFT 131Page 1 22 – Visual BASIC 2005.
Mark Dixon, SoCCE SOFT 131Page 1 24 – Web applications: Writing data to Databases using ASP.
Mark Dixon, SoCCE SOFT 131Page 1 23 – Modular Design in ASP.
Mark Dixon, SoCCE SOFT 136Page 1 02 – Software Development Life-Cycle.
Mark Dixon, SoCCE SOFT 136Page 1 11 – User Defined Functions.
Mark Dixon, SoCCE SOFT 131Page 1 13 – Object Oriented Analysis, Design, and Programming.
Mark Dixon, SoCCE SOFT 131Page 1 07 – Iterative Execution.
Mark Dixon, SoCCE SOFT 131Page 1 04 – Information Processing: Expressions, Operators & Functions.
Mark Dixon, SoCCE SOFT 131Page 1 06 – Iteration. Mark Dixon, SoCCE SOFT 131Page 2 Session Aims & Objectives Aims –Revise Variables and Conditional execution.
Mark Dixon, SoCCE SOFT 131Page 1 10 – Enumerated Data Types & Procedure Parameters.
Mark Dixon, SoCCE SOFT 131Page 1 20 – Web applications: HTML and Client-side code.
Mark Dixon, SoCCE SOFT 131Page 1 15 – Object Associations.
Mark Dixon, SoCCE SOFT 131Page 1 13 – Coursework 2 Debrief: Numbers Game.
Mark Dixon, SoCCE SOFT 131Page 1 03 – Debugging & Graphics.
Mark Dixon, SoCCE SOFT 131Page 1 06 – Iteration. Mark Dixon, SoCCE SOFT 131Page 2 Session Aims & Objectives Aims –To introduce the main concepts involved.
Mark Dixon, SoCCE SOFT 131Page 1 16 – Web applications: HTML and Client-side code.
Mark Dixon, SoCCE SOFT 131Page 1 04 – Information Processing: Data-types, Variables, Operators & Functions.
Mark Dixon, SoCCE SOFT 131Page 1 07 – Constants, Arrays, & Structures.
Mark Dixon, SoCCE SOFT 131Page 1 19 – Procedure Parameters.
Mark Dixon, SoCCE SOFT 131Page 1 08 – Procedures.
Mark Dixon, SoCCE SOFT 131Page 1 02 – Software Development Lifecycle, & User Interface Design.
Mark Dixon, SoCCE SOFT 131Page 1 10 – Variable Scope, and Arrays of Structures.
Mark Dixon, SoCCE SOFT 131Page 1 08 – Iterative Execution.
Introduction to computers & Visual Basic School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Monday 1/27/2003)
Mark Dixon, SoCCE SOFT 131Page 1 16 – Passing Data between pages: Sessions, Query Strings, & Self Posting.
Mark Dixon, SoCCE SOFT 131Page 1 05 – Conditional Execution.
Mark Dixon Page 1 02 – Queries: Query by Example.
Mark Dixon, SoCCE SOFT 131Page 1 10 – User Defined Functions.
Slide 1 ICS 012 Visual Programming I Ahmed Esmat Second.
Mark Dixon, SoCCE SOFT 131Page 1 12 – Enumerated Data-Types & Pass-by-reference.
Mark Dixon, SoCCE SOFT 131Page 1 18 – Structured Query Language.
Mark Dixon, SoCCE SOFT 136Page 1 06 – Information Processing: Data-types, Constants, Variables.
Mark Dixon Page 1 20 – Web applications: Writing data to Databases using ASP.
Mark Dixon, SoCCE SOFT 131Page 1 09 – User Defined Procedures: Scope, and Parameters.
Mark Dixon, SoCCE SOFT 131Page 1 25 – Soft 131 Examination Revision.
Mark Dixon, SoCCE SOFT 131Page 1 11 – Arrays of Structures & Modules.
VB Code Statements 3 types of VB statement The Remark statement, known as comments, are used for project documentation only Begin with an apostrophe Not.
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.
Mark Dixon, SoCCE SOFT 131Page 1 03 – Debugging, Sound, and Graphics.
Mark Dixon, SoCCE SOFT 131Page 1 19 – Web applications: Server-side code (ASP)
Mark Dixon, SoCCE SOFT 131Page 1 02 – Software Development Lifecycle, & User Interface Design.
Mark Dixon Page 1 22 – Coursework 2 Debrief: Phonics.
Mark Dixon, SoCCE SOFT 131Page 1 05 – Information Processing: Data-types, Variables, Operators & Functions.
Mark Dixon, SoCCE SOFT 131Page 1 20 – Web applications: Writing data to Databases using ASP.
Intellicad Visual Basic Application Marian Kate Santos Programming Paradigm.
Mark Dixon Page 1 23 – Web applications: Writing data to Databases using ASP.
Mark Dixon, SoCCE SOFT 136Page 1 9 – Procedures. Mark Dixon, SoCCE SOFT 136Page 2 Session Aims & Objectives Aims –To introduce the main concepts involved.
Mark Dixon 1 11 – Array Variables. Mark Dixon 2 Questions: Loops What is the value of t, after this code executes? t = 0 For x = 4 To 6 t = t + x Next.
Mark Dixon, SoCCE SOFT 131Page 1 05 – Variables. Mark Dixon, SoCCE SOFT 131Page 2 Admin: Test (next week) In class test –teaching week 6 –university week.
CS285 Visual Basic 2 Department of Computing UniS 1 Statements in Visual Basic A statement is the fundamental syntactical element of a program smallest.
Mark Dixon, SoCCE SOFT 131Page 1 23 – Object Associations.
Mark Dixon, SoCCE SOFT 131Page 1 24 – Datatypes and Object Association.
Vocabulary in VB So Far. Assignment: Used to change the value of an object at run time Used to change the value of an object at run time.
Mark Dixon, SoCCE SOFT 131Page 1 04 – Information Processing: Expressions, Operators & Functions.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Mark Dixon, SoCCE SOFT 131Page 1 16 – Visual BASIC 6.0.
Mark Dixon, SoCCE SOFT 131Page 1 18 – Enumerated Data Types and Arrays of Structures.
Introduction to OOP in VB.NET using Robots ACSE Conference, Nov 2004 Michael Devoy Monsignor Doyle C.S.S., Cambridge
Mark Dixon 1 22 – Object Oriented Programming. Mark Dixon 2 Questions: Databases How many primary keys? How many foreign keys? 3 2.
Mark Dixon, SoCCE SOFT 131Page 1 17 – Procedures.
Mark Dixon 1 15 – Structured Programming. Mark Dixon 2 Admin: Test 2 In class test –11 Feb 2014 –4 Feb 2014: revision (technique) session 50 mins short.
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.
Adding Code to the Option Button. Open VB 1.Double click the Calculate button and select General from the Object list box. 2.Add the following code to.
Week 1 Lecture 1 Slide 1 CP2028 Visual Basic Programming 2 “The VB Team” Copyright © University of Wolverhampton CP2028 Visual Basic Programming 2 v Week.
Intellicad Visual Basic Application
To understand what arrays are and how to use them
Presentation transcript:

Mark Dixon, SoCCE SOFT 131Page 1 13 – Control Arrays & Container Controls

Mark Dixon, SoCCE SOFT 131Page 2 Assignment Object naming conventions: txt – text box btn – command button pic – picture box Appropriate use of: –indentation –remarks –constants (no magic numbers) –variables (module level, and local) –procedures/functions –arrays –structures –enumerate data types

Mark Dixon, SoCCE SOFT 131Page 3 Project Files Ensure that you submit: –project file (*.vbp) –all form files (*.frm, and *.frx) –all module files (*.bas)

Mark Dixon, SoCCE SOFT 131Page 4 Session Aims & Objectives Aims –To introduce the idea of control arrays –To introduce the idea of container controls Objectives, by end of this week’s sessions, you should be able to: –Create and use a control array –Create and use a container control

Mark Dixon, SoCCE SOFT 131Page 5 Control Arrays Several controls have same name Distinguished by unique index Very similar to a variable array Makes it easier to do same thing to all controls – using for loop

Mark Dixon, SoCCE SOFT 131Page 6 Example: Ships - UI lblMooringID picMain(3) picMain(1) picMain(2) picMain(0) Four controls share same name (picMain):

Mark Dixon, SoCCE SOFT 131Page 7 Example: Ships - Code Option Explicit Sub Draw() Dim i As Long For i = 0 To 3 picMain(i).DrawWidth = 3 picMain(i).Line (1000, 1000)-(2000, 1000) picMain(i).Line -Step(-200, 200) picMain(i).Line -Step(-600, 0) picMain(i).Line -Step(-200, -200) Next End Sub Private Sub picMain_Click(Index As Integer) lblMooringID.Caption = Index Draw End Sub

Mark Dixon, SoCCE SOFT 131Page 8 Control Arrays - How To create a control array, either: –Create a control with the same name as an existing control (VB will ask you if you want to create a control array) Or: –Create a control and type a value into its index property (e.g. 0)

Mark Dixon, SoCCE SOFT 131Page 9 Container Controls Some controls can contain other controls: –Picture boxes –Frames The container (parent) control clips the contained (child) controls –The child controls will not be displayed outside the boundary of their parent

Mark Dixon, SoCCE SOFT 131Page 10 Example – Pic Container The inner picture box is clipped: picInner picOuter