CSI 101 Spring 2009 Review and Recap of Visual Basic Wednesday, April 29 th.

Slides:



Advertisements
Similar presentations
Introduction to File I/O How to read & write data to a disk file...
Advertisements

Excel and Visual Basic. Outline Data exchange between Excel and Visual Basic. Programming VB in Excel.
Visual Basic for Applications. What it does Extends the features and built in functions of Excel – Create and run VB procedures – Some may be easy to.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Summary of text to be covered Create your own class Create and use objects of your own class Control access to object instance variables Use keyword private.
CSI 101 Elements of Computing Spring 2009 Lecture #6: Data Types and Variables in Visual Basic Wednesday, Februrary 11th, 2009.
Chapter 6 - Visual Basic Schneider1 Chapter 6 Repetition.
Data Types and Operations Programming Fundamentals (Writing Code)Programming Fundamentals (Writing Code)
CSI 101 Elements of Computing Spring 2009 Lecture #13 Programming in Visual Basic March 25 th – April 4 th, 2009.
CSI 101 Elements of Computing Spring 2009 Lecture # 14 – Classes and Objects Wednesday, April 15th, 2009 and Monday, April 20th, 2009.
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Chapter 5 new The Do…Loop Statement
Chapter 8: String Manipulation
Shell Scripting Awk (part1) Awk Programming Language standard unix language that is geared for text processing and creating formatted reports but it.
Practical PHP IDIA Spring 2012 Bridget M. Blodgett.
Tutorial 14 Working with Forms and Regular Expressions.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering.
Mr C Johnston ICT Teacher BTEC IT Unit 06 - Lesson 05 Learning To Program.
Lesson 1: Introduction to ABAP OBJECTS Todd A. Boyle, Ph.D. St. Francis Xavier University.
COM148X1 Interactive Programming Lecture 3. Topics Today String Functions Using Timer Looping.
Class 3 Programming in Visual Basic. Class Objectives Learn about input/output Learn about strings Learn about subroutines Learn about arrays Learn about.
07/10/ Strings ASCII& Processing Strings with the Functions - Locate (Instr), Mid, Length (Len), Char (ChrW) & ASCII (Asc)
Language Elements 1. Data Types 2 Floating Point (real) Single Precision Double Precision Decimal Fixed Point (integer) Byte Short Integer Long Numerical.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
6.3 List Boxes and Loops Some Properties, Methods, and Events of List Boxes List Boxes Populated with Strings List Boxes Populated with Numbers Searching.
MAT Meyer Week 2 Programming VB: ‘basics’ Review & preview: Events, variables, statements, etc. Images, Control arrays, For/Next Assignment: read.
Chapter 10: Structures and Sequential Access Files
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
Using Visual Basic for Applications in Microsoft Project Sean Vogel.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Chapter 16: Programming Structures Spreadsheet-Based Decision Support Systems Prof. Name Position (123) University Name.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 24 The String Section.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
© 1999, by Que Education and Training, Chapter 9, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
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.
Lab 6 (2) Arrays ► Lab 5 (1) Exercise Review ► Array Concept ► Why Arrays? ► Array Declaration ► An Example of Array ► Exercise.
String and General Procedures. Answer to the last question of Exam 1 Start Get a number Divide the Number By 2 Is the quotient Equal to 1? Print The Remain.
Repetition. Loops Allows the same set of instructions to be used over and over again Starts with the keyword loop and ends with end loop. This will create.
Arrays and others. Annoucement Today’s office hour move to Friday 1:00PM to 3:00PM Today’s office hour move to Friday 1:00PM to 3:00PM Today Today  Call.
1 Chapter 3 – Examples The examples from chapter 3, combining the data types, variables, expressions, assignments, functions and methods with Windows controls.
Pay Example (PFirst98) Please use speaker notes for additional information!
Chapter 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
Lesson 16. Practical Application 1 We can take advantage of JavaScript and the DOM, to set up a form so that the first text box of a form automatically.
String Manipulation 10/21/2015 Lect#6 GC Strings have their own properties and methods, just like a textbox or label or form does. 10/21/2015 Lect#6.
CS4 –lecture 6 Wednesday, Jan 19, 2011 Roxana Gheorghiu.
© 2006 Lawrenceville Press Slide 1 Chapter 6 The Post-Test Do…Loop Statement  Loop structure that executes a set of statements as long as a condition.
CS130 Visual Basic Project 4 Lecture Fall New topics in project 4 Database, file (table), records, fields. Application that contains menus, submenus,
Visual Basic CDA College Limassol Campus COM123 Visual Basic Programming Semester C Lecture:Pelekanou Olga Week 3: Using Variables.
05/02/ Records. 205/02/2016 Learning Objectives State: The difference between records and arrays. The difference between records and arrays. How.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Chapter 23 The String Section (String Manipulation) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Tutorial 8: Manipulating Strings1 Tutorial 8 Manipulating Strings.
CIS 338: VB Variables Dr. Ralph D. Westfall April, 2011.
1 VB-06-String Manipulation Mar 03, 2002 String Function VISUAL BASIC.
© 2010 Lawrenceville Press Slide 1 Chapter 5 The Do…Loop Statement  Loop structure that executes a set of statements as long as a condition is true. 
GCSE COMPUTER SCIENCE Practical Programming using Python
Programming Right from the Start with Visual Basic .NET 1/e
Microsoft Visual Basic 2008: Reloaded Third Edition
A variable is a name for a value stored in memory.
Visual Basic 6 (VB6) Data Types, And Operators
Chapter 6 Variables What is VBScript?
CIS16 Application Development and Programming using Visual Basic.net
VB Decisions & Conditions
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Introduction to Computer Science
Text / Serial / Sequential Files
Presentation transcript:

CSI 101 Spring 2009 Review and Recap of Visual Basic Wednesday, April 29 th

List of Concepts Variables and Data types Conditional processing Looping Specialized functions –Type Conversion –String Manipulation –File Processing –Formatting –Date processing

List of Concepts, cont Subroutines and functions Classes and objects Events and event procedures Using properties

What you’re good at Variables and data types IF statements Setting up functions (FUNCTION statement) File processing

What we’ll skip Classes and objects –Covered pretty well in previous lecture Type conversion –List in inside front cover of text –Encountered in class examples and homework Formatting –For aesthetic output, not functionally important

Quick recap - Conditional SELECT statement –Alternative to IF –Allows large number of alternatives –Condition tested is a VALUE, not a Yes or No response

SELECT example Check if a string starts with a letter or digit

SELECT example Check if a string starts with a letter or digit SELECT CASE Left(testString,1) CASE “A” to “Z” MsgBox(“Starts with letter”) CASE “a” to “z” MsgBox(“Starts with letter”) CASE “0” to “9” MsgBox(“Starts with digit”) End Select

Looping Recap DO or FOR DO has two conditions –Until or While –Can be placed at beginning (with DO) or end (with Loop) Do ends with Loop For ends with Next

For example with array Calculate the average of the values in an array Need a running sum Use Length method on arrays to get count

For example with array - code Dim index As Byte, sum as Integer = 0 For index = 1 to array.length sum += array(index) Next index Dim average As Decimal = sum/array.length

For example with strings Count number of lowercase letter ‘s’ in a particular string Need to look at EACH character in the string at a time Need running count Use a variable much like an array index to mark where we are in the string

For example with strings - code Dim count As Byte = 0 Dim index As Byte For index = 1 to Len(testString) If Mid(testString,index,1) = “s” then count += 1 End if Next index

String function Recap Most common ones: –Len(string) – returns number of characters in string –Mid(string,start,len) – returns substring starting at start position and for length of len –Left(string,len) – returns substring which is first len characters of string –Trim(string) – remove leading and trailing blanks

Properties and Dates Let’s finish last ones with an interesting example: –We’ll read employee records from a file –Assume we already have an employee structure –If date of last raise is greater than 18 months, increase salary by 4% –Place employee name and new salary into text boxes on the form –This is contained in the event procedure for the NEXT button

Needs Open file OUTSIDE of event procedure –Procedure looks for NEXT employee who requires a raise –Reopening file would start us back at the beginning Remember to Refresh

Code Example Code outside of event procedure: –Definition of Employee structure Key fields: –Name –LastRaise –Salary –Opening file: FileOpen(1, “Employees”)

Code Example, cont Within procedure: Sub btnNext_Click() Dim inEmp As Employee Dim found As Boolean = False Do until found = True Or EOF(1) FileGet(1,inEmp) If DateDiff(“m”,inEmp.LastRaise, Now()) >= 18 then inEmp.Salary *=.04

Code example, cont. found = True txtName.Text = inEmp.Name txtSalary.Text = CStr(inEmp.Salary) End if Loop ‘Check if not found If found = False then txtName.Text = “DONE” Refresh End Sub