1 Prototyping for HCI Spring 2004 (Week 8) Jorge A. Toro.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Select Case Statements and Selection Input.
Advertisements

Pemrograman VisualMinggu …3… Page 1 MINGGU Ke Tiga Pemrograman Visual Pokok Bahasan: Class, Objects, Methods and Instance Variable Tujuan Instruksional.
Chapter 7: Sub and Function Procedures
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 3rd Edition.
1 Prototyping for HCI Spring 2004 (Week 10) Jorge A. Toro.
Creating Object Oriented Programs Object oriented (OO) terminology Class vs. object Instantiate an object in a project Understand Class_Initialize / Terminate.
SUNY Morrisville-Norwich Campus-Week 12 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Using the Visual Basic Editor Visual Basic for Applications 1.
Classes with multiple methods Part 1. Review of classes & objects Early on, we learned that objects are the basic working units in object-oriented programs.
Guide To UNIX Using Linux Third Edition
CSI 101 Elements of Computing Spring 2009 Lecture # 14 – Classes and Objects Wednesday, April 15th, 2009 and Monday, April 20th, 2009.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Tutorial 7: Sub and Function Procedures1 Tutorial 7 Sub and Function Procedures.
Using Data Active Server Pages Objectives In this chapter, you will: Learn about variables and constants Explore application and session variables Learn.
Neal Stublen Overview of.NET Windows Applications Microsoft Windows OS / Intel Platform Windows Application File SystemNetworkDisplay.
Introduction to VB.NET Tonga Institute of Higher Education.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Microsoft Visual Basic 2005: Reloaded Second Edition
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 6 Multiple Forms.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
1 Web-Enabled Decision Support Systems Objects and Procedures Don McLaughlin IE 423 Design of Decision Support Systems (304)
Multiple Forms and Standard Modules
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
Why to Create a Procedure
Chapter 10: Writing Class Definitions Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
Multiple Forms, Container Controls, AddHandler This presentation is based on the Forms and ContainerControls VB Projects 1.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
OCC Network Drives  H:\  P:\ 
1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
CIS 338: Classes and Modules Dr. Ralph D. Westfall May, 2011.
Programming in Java CSCI-2220 Object Oriented Programming.
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
VB Classes ISYS 512/812. Object-Oriented Concepts Abstraction: –To create a model of an object, for the purpose of determining the characteristics (properties)
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
EGR 2261 Unit 11 Classes and Data Abstraction  Read Malik, Chapter 10.  Homework #11 and Lab #11 due next week.  Quiz next week.
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.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
6-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Classes, Interfaces and Packages
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
CE-105 Spring 2007 By: Engr. Faisal ur Rehman
EGR 2261 Unit 13 Classes Read Malik, Chapter 10.
IS 350 Application Structure
Chapter 1: An Introduction to Visual Basic 2015
Chapter 6 Multiform Projects
Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline Test-Driving the Microwave Oven Application Designing.
CIS16 Application Development Programming with Visual Basic
Tonga Institute of Higher Education
Accessing Databases with ADO.NET, Handling Exceptions, and Printing
Chapter 8 - Functions and Functionality
February , 2009 CSE 113 B.
Overview of the IDE Visual Studio .NET is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging programs (also.
Presentation transcript:

1 Prototyping for HCI Spring 2004 (Week 8) Jorge A. Toro

2 The Language Custom Classes

HCI430 – J.Toro3 Custom classes VB.NET is Object-Oriented So far, you have handled pre-defined classes (Form, Button, Integer, String, etc…) -but- You can also create your own classes that can ease the coding and fit the needs of your prototype

HCI430 – J.Toro4 Custom classes How do you know when you need a custom class?  You need to do some design decisions on what kind of classes you will need.  There is no golden rule in this, many different classes can be created and used, it all depends how you want to architect your code.

HCI430 – J.Toro5 Custom classes When you are writing the code inside a form, you are actually writing the code for the Form’s class…

HCI430 – J.Toro6 Your form Your form is defined as a class

HCI430 – J.Toro7 Custom classes Creating a custom class  Custom classes are created in separate files  Same as different forms are in separate files  To add a custom class file 1. File -> Add New Item… 2. Select Class, give a name to it 3. Done.

HCI430 – J.Toro8 1

9 2 1 Select Class 2 Name the Class

HCI430 – J.Toro10 3 The class file appears in your Solution Explorer window This code is automatically generated. Here is where you write the code to define the properties and methods of your class.

HCI430 – J.Toro11 Custom classes Defining properties for the class  One way: Declare global variables as Public. Public Class Member Public p_id As String Public p_lname As String Public p_fname As String Public p_address As String Public p_city As String Public p_state As String Public p_zip As String End Class Properties

HCI430 – J.Toro12 Member class

HCI430 – J.Toro13 Custom classes Using your custom class  You create instances (objects) of the class Use the New keyword, the same way you use it to create forms.

HCI430 – J.Toro14 Form1 class You now can declare Member objects

HCI430 – J.Toro15 Custom classes Everything declared with either Dim or Private will not be accessible from outside the class.

HCI430 – J.Toro16 p_ssn is not declared Public. It will be accessible only inside this class. Member Class

HCI430 – J.Toro17 p_ssn is not accessible outside the class, it was not declared Public. x is an instance of Member class Form1 Class

HCI430 – J.Toro18 Custom classes Defining methods  All the subs and Functions declared Public are considered methods and are accessible outside the class.

HCI430 – J.Toro19 ResetNames is a Sub declared Public. It will be accessible outside. Member Class

HCI430 – J.Toro20 ResetNames is accessible. Form1 Class

HCI430 – J.Toro21 Custom classes Sometimes, you want your object to start with some preset values in some of its properties.  Constructor Used to provide values to the properties when an instance is created You can have different constructors for different situations A constructor is always declared as Public and it is always named New

HCI430 – J.Toro22 Constructor1 (default) Constructor2 (custom)

HCI430 – J.Toro23 constructor1 is used here constructor2 is used here

24 The Language Modules

HCI430 – J.Toro25 Modules Modules are files where you can write code that does not belong to any particular form.  Global functions  Global Subs  Global variables Global variables declared in a Module are global to all the project.

HCI430 – J.Toro26

HCI430 – J.Toro27 1 Select Module 2 Name the Module

HCI430 – J.Toro28 The module file appears in your Solution Explorer window This code is automatically generated. Here is where you write the code.

HCI430 – J.Toro29 Modules Sub Main  You can set the Startup Object of your project to a special sub named Main  You create the Sub Main inside a Module file.

HCI430 – J.Toro30 mainForm is a global variable mainForm is created mainForm is shown

HCI430 – J.Toro31 Modules In the previous example, if you set your startup object of your project to be the Sub Main, you have to create the instance of Form1 and show it. This is useful when you have a prototype with many form files.

32 The Language Class Libraries

HCI430 – J.Toro33 Class libraries A separate project for creating classes for use in other applications This is what you will get from me  A project with some classes inside

HCI430 – J.Toro34 Class libraries Using the library in your prototype  (1/2) Add the library into your prototype’s project

HCI430 – J.Toro35

HCI430 – J.Toro36 Select the project name

HCI430 – J.Toro37 The project appears into the Solution explorer

HCI430 – J.Toro38 Class libraries Using the library in your prototype  (2/2) Reference the class library in your project so you can start using the classes Why do you have to do this?  Because the classes I wrote are inside a separate project, they are not part of yours.

HCI430 – J.Toro39 1 Select your project 2 Select “Add Reference”

HCI430 – J.Toro40 1 Click over the Projects tab 2 Select the Utils Project 3 Click Select

HCI430 – J.Toro41 The library will appear here Click Ok

HCI430 – J.Toro42 The Utils library will appear listed under the References folder in your project

HCI430 – J.Toro43 Questions?