Visual Basic: Week 5 Review User defined functions

Slides:



Advertisements
Similar presentations
What Was I Thinking??. Key Terms 1. Control 1. Control 2. Design Mode 2. Design Mode 3. Event 3. Event 4. Form 4. Form 5. Interface 5. Interface 6. Properties.
Advertisements

VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
Slide 1 Forms v Parts of a form v Form: Program User Interface v Controls are contained inside forms v Control event handlers are contained inside forms.
Introduction to Computing Dr. Nadeem A Khan. Lecture 13.
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.
Introduction to Visual Basic Chulantha Kulasekere.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
CS0004: Introduction to Programming Events. Review  Event Procedure  A set of instructions to be executed when a certain event happens.  Many event-driven.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
CS 104 October 26, 2011 App Inventor. Agenda Discuss guest speakers Discuss quiz Finish Paint Pot Discuss concepts from Chapters 2 & 3 Mole Mash (if time.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Visual Basic Games: Prepare for Hangman
Visual Basic Games: Week 3 Global variables, parameters, Select, KeyDown Enable, Visible, Focus State of Game Read chapter 3.
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
Review for Mid-term! October 26, Review Homework Worksheet True or False Operators are symbols that perform specific operations in Visual Basic.
MAT Meyer Week 2 Programming VB: ‘basics’ Review & preview: Events, variables, statements, etc. Images, Control arrays, For/Next Assignment: read.
Copyright © 2001 by Wiley. All rights reserved. Chapter 4: The Selection Process in Visual Basic Selection Process Two Alternative Structure If..Then..ElseIf.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Chapter 9 - VB.Net by Schneider1 Chapter 9 – Additional Controls and Objects 9.1 List Boxes, Combo Boxes, and the File-Opening Control The List Box Control.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Visual Basic.NET BASICS Lesson 3 Events and Code.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
Arrays1 From time to time an object (a variable, a picture, a label or a command) does not serve as well as a set of objects of a similar kind addressed.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
Illustration of a Visual Basic Program Running an Ada Program 1 by Richard Conn 11 September 1999.
3.9 to  Also refer to as Program  Contains set of instructions that tells the computer how to perform specific task.  Each line of code is referred.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
‘Tirgul’ # 2 Enterprise Development Using Visual Basic 6.0 Autumn 2002 Tirgul #2.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
Pay Example (PFirst98) Please use speaker notes for additional information!
Lesson 4 Mathematical Operators! October 6, 2009.
Arrays Chapter 8. Overview u General discussion u Variable arrays u Control arrays u Multi-dimensional variable arrays  Two-dimensional  Three-dimensional.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Programming games in Visual Basic Review programming & VB topics Insertion sort. Best times. Generate questions & answer patterns for quiz Lab/Homework:
Controlling Program Flow with Decision Structures.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Sorry, the pen lost control. Anyway, you need to download both the.vbp and the.frm for each project. I looked at PrCalc, I did not look at inventory.
Visual Basic A Quick Tutorial VB Review for ACS 367.
More Visual Basic!. Creating a Standalone Program A standalone program will allow you to make a program file that can be run like other Windows programs,
Data and variables in Visual Basic. Annoucement Lecture on Thursday 7:30PM C106 Visual Basic download: 
Visual Basic 6 Programming Decide how many variables you need by looking at this form. There is one textbox for input and there are 3 labels for output,
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Chapter 8 Multiple Forms, Modules, and Menus. Introduction This chapter demonstrates how to: – Add multiple forms to a project – Create a module to hold.
Visual Basic Fundamental Concepts
Programming Right from the Start with Visual Basic .NET 1/e
Chapter 8: Writing Graphical User Interfaces
1. Introduction to Visual Basic
Microsoft Office Illustrated
Please use speaker notes for additional information!
Event Driven Programming
Visual Basic..
Chapter 6 Sub Procedures
Department Array in Visual Basic
Hands-on Introduction to Visual Basic .NET
Please use speaker notes for additional information!
Simple Windows Applications
Chapter 3: Introduction to Problem Solving and Control Statements
Visual Basic Programming Chapter Four Notes Working with Variables, Constants, Data Types, and Expressions GROUPBOX CONTROL The _____________________________________.
CS285 Introduction - Visual Basic
Project Design, Forms and Buttons
Visual C# - GUI and controls - 1
3.Visual Basic Controls.
Presentation transcript:

Visual Basic: Week 5 Review User defined functions Busy wait versus Timers Homework: read chapter 4. Acquire images for ‘cards’. Will work on Memory in class. Two more projects before Spring vacation. Will post practice quiz.

Review Visual Basic development includes Placing controls on the form Textbox, label, command button, list box, image control Control arrays of any type control Writing code for event procedures Form_Load, command button Click, list box Click Any others?

Code Assignment statements If/Then/Else Select Case For/Next target = expression If/Then/Else Select Case For/Next Anything else?

Built-in functions Int Randomize, Rnd Str Val Format Any others?

Event procedures Also known as event handlers Visual Basic defines them. Defines the header. Visual Basic invokes them when an event happens. You write the code to do something—what you want to happen when a specific event occurs. You write the code in the code window, which you get to by double clicking on the specific control. Code in the wrong event procedure won’t do what you want.

Controls Each control type has its own set of properties All control types have (name) Many have position properties: Left, Top Form, command button and Label have Caption Textbox has Text (can be changed by player) Command button (also Timer) has Enabled. Many have Visible. Image has Picture. Properties can be changed at Design time and by code during Run time. Design time: The (name) is at the top of the Properties window. The properties window is for the selected control on the form. Properties can be changed implicitly by moving a control or changing its size or creating new elements of a control array or by directly changing the properties.

Control array event procedure Suppose lblCards is an array of label controls The event procedure for clicking on any of the elements of the control array is Sub lblCards_Click(Index as Integer) Where Index will hold the index for the specific element clicked. You use Index in your code. For example, you will use this in Memory. This will be used in many projects.

Creating a User-Defined Procedure A user defined procedure is one in which you define (author) the header as well as write the code. User defined procedures can be functions or subroutines, meaning they can return values or not. Call setupcards If hittarget(x,y) then You write the user defined procedure in the code window. Don’t write it inside another procedure.