CE 311 K Introduction to Computer Methods VB Controls and Events Daene C. McKinney.

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

An Introduction to Visual Basic Terms & Concepts.
VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
1.4 Programming Tools Flowcharts Pseudocode Hierarchy Chart
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
Chapter 2 –Visual Basic, Controls, and Events
Chapter 1 - An Introduction to Computers and Problem Solving
1 CS 106, Winter 2009 Class 4, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
Programming Tools Flowcharts Pseudocode Algorithm Chapter 2.
CA 121 Intro to Programming Tariq Aziz and Kevin Jones GUI Programming in Visual Studio.NET Chapter 1 Tariq Aziz and Kevin Jones.
Compunet Corporation Programming with Visual Basic.NET GUI Week # 11 Tariq Ibn Aziz.
Chapter 1 Program Design
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Introduction To Visual Basic 6. Announcements  Thursday, Oct 9th, 7:30PM, C106 Lloyd Douglas (NSF) Diversity in Science-Who needs it? 5 extra credits.
Introduction to Visual Basic Chulantha Kulasekere.
Chapter 2 –Visual Basic, Controls, and Events
Slide 1 Chapter 2 Visual Basic Interface. Slide 2 Chapter 2 Windows GUI  A GUI is a graphical user interface.  The interface is what appears on the.
Visual Basic Chapter 1 Mr. Wangler.
1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development.
CS 0004 –Lecture 8 Jan 24, 2011 Roxana Gheorghiu.
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
An Introduction to Visual Basic
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
Teacher: Ms. Olifer MICROSOFT VISUAL STUDIO 2010: PROPERTIES OF WINDOWS FORM OBJECT.
Visual Basic 101.
Chapter 1 - VB 2008 by Schneider1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and.
Chapter 11 An Introduction to Visual Basic 2008 Why Windows and Why Visual Basic How You Develop a Visual Basic Application The Different Versions of Visual.
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Chapter 3 Introducing Visual Basic
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Outline Software and Programming Program Structure Tools for Designing Software Programming Languages Introduction to Visual Basic (VBA)
CHAPTER TWO INTRODUCTION TO VISUAL BASIC © Prepared By: Razif Razali 1.
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
Chapter Two Creating a First Project in Visual Basic.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
Chapter 11 An Introduction to Visual Basic 2005 Why Windows and Why Visual Basic How You Develop a Visual Basic Application The Different Versions of Visual.
Chapter 11 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and Files 1.3 Program Development.
What is Visual Basic.NET? 110 B-1 e.g. a word processor doesn’t do anything until the user clicks on a button, types text... A programming language that.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
Chapter 1 - VB 2008 by Schneider1 Chapter 1 - An Introduction to Computers and Problem Solving 1.1 An Introduction to Computers 1.2 Windows, Folders, and.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 4: Do-It-Yourself Designing (Designing Interfaces)
Introduction To Visual Basic 6
Visual Basic.NET Windows Programming
Visual Basic Code & No.: CS 218
Introduction to Computer CC111
Chapter Topics 15.1 Graphical User Interfaces
1. Introduction to Visual Basic
An Introduction to Visual Basic
An Introduction to Visual Basic .NET and Program Design
Chapter 2- Visual Basic Schneider
Chapter 2- Visual Basic Schneider
An Introduction to Computers and Visual Basic
Chapter 15: GUI Applications & Event-Driven Programming
Presentation transcript:

CE 311 K Introduction to Computer Methods VB Controls and Events Daene C. McKinney

Introduction Program Planning and Flowcharts Visual Basic Visual basic Interface VB Controls Creating a Project

Why Visual Basic? #1 Reasons – Graphical User Interface (GUI) - easily constructed – More fun for students than other languages! The “other” reasons – General purpose, machine-independent language – Powerful and flexible language – Popular (used by many programmers, it’s been around since …. well MS DOS. Yeah, Bill Gates wrote it!) – Portable (works on all PC’s) – Small language (few components) – Modular (easily maintainable)

VB Programs Developing a VB Program – Design the GUI (buttons, text boxes, etc.) – Determine the events that the controls (buttons, etc.) will recognize – Write the procedures for those events Running a VB Program – VB monitors the controls in the window for events – When it detects an event, execute procedure for that event – Return to monitoring Sounds easy, but it can be frustrating! What’s an EVENT? CLICK! What’s a PROCEDURE? RUN? Is this a race?

Flowcharting Flowchart – Graphic representation of the sequence of steps in a process Flowchart Symbols – Start/Stop – Line – Input/Output – Processing – Decision yes no Start Stop Decision Process This can save your &^%$ when you lose track of what you’re doing!

Example: Stamp Problem Program Purpose: Determine the proper number of stamps for a letter – Read sheets – Set the number of stamps to sheets/5 – Round the number of stamps up to the next whole number – Display the number of stamps Start Read sheets Set stamps = sheets/5 Round stamps up To next whole # Display stamps End Input Processing Output Flowchart Pseudocode

Decisions If condition is true, then Process step(s) 1 Else Process step(s) 2 End if Is condition True? Process Step(s) 1 Process Step(s) 2 No Yes Flowchart Pseudocode

Average Grade Problem Start Sum=0 Count = 0 Input Grade More grades? Sum = Sum + Grade Count = Count + 1 Average = Sum/Count Stop No Yes Flowchart Pseudocode BEGIN Average Grade sum=0 count = 0 LOOP WHILE grade > 0 sum = sum + grade count = count +1 END LOOP average = sum/count END Average Grade Input Grade Note: This program will crash if there are no grades input, i.e., count = 0 Note: We can translate this pseudocode into any programming language.

VB Interface New Project Button

Creating a New Project in VB Windows Forms Application

VB “Form Designer” Window Project Controls Form To activate controls, select “Toolbox” and press “Push-Pin”

VB “Form Designer” Window Project Controls Form

A Little Visual Basic Controls – Picture boxes (pic) – Text boxes (txt) – Buttons (cmd)

Visual Basic Objects Useful Objects – List Boxes – Text Boxes – Picture Boxes – Labels – Buttons Useful Object Properties – Name – Caption – Border style – Visible – Back Color – Alignment – Font

Visual Basic Events When a VB program runs – A Form and some Controls appear on the screen Nothing happens until user takes an action – Event Most Events are associated with Controls – Objects Programmer writes Code to respond to events – Procedures

Boxes and Buttons VB: Object-oriented language – Objects: Controls Text boxes, Picture boxes, Buttons, etc – Procedures: tasks that objects perform Dot separates object name from method (TextBox1.TEXT) Method: Assign text to a text box Button code Button

Creating a Visual Basic Program 1.Identify Problem 2.Design Algorithm 3.Design GUI (interface) 4.Create Objects 5.Set Properties 6.Write Procedures for Events (button clicks, etc.) 7.Test Your Program Identify Problem Design Algorithm Design GUI Create Objects Set Properties of Objects Write Procedures for Events Test

Homeworks Install – VB-2008 from the MS website or the CD at back of the book Do – Homework problems in VB Learn – How to create VB projects and solve problems Make – Screenshots and paste them into Word docs Use – Your computer

Summary Program Planning and Flowcharts Visual Basic Visual basic Interface VB Controls Creating a Project