Knowledge Base. Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double.

Slides:



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

1.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Val Function A Function performs an action and returns a value The expression to operate upon, known as the argument, (or multiple arguments), must be.
Text Box controls are used when users are required to type some input (during program execution), or output is displayed on the form (known as the user-
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Comparing Numeric Values If Val(Text1.Text) = MaxPrice Then (Is the current numeric value stored in the Text property of Text1 equal to the value stored.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Lec2 P 1 CP2030 Visual Basic For C++ Programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 2 Back to Index v Basic Data Types v Arithmetic.
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.
Lec4 P 1 CP2030 Visual Basic For C++ Programmers Copyright © University of Wolverhampton CP2030 VBFC Lecture 4 Back To Index v Iteration - Looping v Arrays.
3/9/2004 PPCC - Introduction to VB6 Copyright ©2004, Tore Bostrup 1 Introduction to VB6 Week 2.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
CS0004: Introduction to Programming Input and Output.
Microsoft Visual Basic 2008: Reloaded Fourth Edition
Chapter 4: The Selection Structure
Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
VB Core II Conditional statements Exception handling Loops Arrays Debugging.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
Decisions and Debugging Part06dbg --- if/else, switch, validating data, and enhanced MessageBoxes.
Dialog Boxes – Day 1 Built-in Dialog Boxes Input Box Message Box Custom Dialog Boxes – User Forms.
Conditional Expression One of the most useful tools for processing information in an event procedure is a conditional expression. A conditional expression.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
Variables & Function Calls. Overview u Variables  Programmer Defined & Intrinsic  Data Types  Calculation issues u Using Functions  The val() function.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Pay Example (PFirst98) Please use speaker notes for additional information!
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
CONTROL STATEMENTS. A conditional expression uses a comparison operator which results in true or false value. If the comparision is valid it results in.
Basic Conditions. Challenge: ● Ask the user his/her name ● If it’s “Wally,” jeer him ● Pause video and try on your own.
1 Chapter 4 – Decisions 4.1 Relational and Logical Operators (see other set of slides) 4.2 If Blocks (see other set of slides) 4.3 Select Case Blocks (see.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
31/01/ Selection If selection construct.
Controlling Program Flow with Looping Structures
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
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.
Microsoft Visual Basic 2012 CHAPTER FIVE Decision Structures.
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.
Creation of Variables with Numeric, alphanumeric, date, picture, memo data types Constant - A quantity that does not change during the execution of a program.
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,
More Visual Basic Code: if-then-else, for loops Controls: Multiple forms, List Boxes, Radio buttons, frames,
1 4.2 Selection Logical Operators. 2 Learning Objectives Explain how the logical operator AND Boolean statements works. Directly testing if text boxes.
Making Interactive Programs with Visual Basic .NET
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
An Introduction to Programming with C++1 The Selection Structure Tutorial 6.
Chapter 6 Controlling Program Flow with Looping Structures.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Computer Science Up Down Controls, Decisions and Random Numbers.
TUTORIAL 4 Visual Basic 6.0 Mr. Crone. Pseudocode Pseudocode is written language that is part-code part- English and helps a programmer to plan the layout.
IF STATEMENTS AND BOOLEAN EXPRESSIONS. BOOLEAN EXPRESSIONS Evaluate to a value of true or false Use relational or equivalence operators Boolean operators.
 Type Called bool  Bool has only two possible values: True and False.
Visual Basic Fundamental Concepts
3rd prep. – 2nd Term MOE Book Questions.
Microsoft Visual Basic 2005 BASICS
CHAPTER FIVE Decision Structures.
Making Decisions in a Program
Visual Basic..
Computers & Programming Languages
Chapter (3) - Looping Questions.
If Statements.
Relational Operators.
CHAPTER FOUR VARIABLES AND CONSTANTS
Presentation transcript:

Knowledge Base

Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double

Setting A Variable Assignment Statement Variable or Property = Expression Expression is evaluated Result is Assigned to the Variable

Example Label.Caption = Format(Val(Text.text),”currency”) Let Text.text contain “14.55”

Example Val(Text.text) is Val(“14.55”) Evaluates to the number Format(14.55,”currency”) Evaluates to “$14.55” Assigned to Label.Caption Gives Label.Caption the contents “$14.55”

Getting User Input Text boxes Let the user type input data Val is used to convert to numbers Can be stored in Variables Can be stored in other objects properties

Displaying Output Label Box Captions Label.Caption = a string Label.Caption = Format(number, “type”)

Jumping to Modules Events

Testing Conditions If Then If condition Then code End If If condition Then code Else code End If

Conditions Comparisons of like types Equal = Less Than < Greater Than > Not Equal <>

Conditions Less Than or Equal <= Greater Than or Equal >=

Logical Operators Evaluate relationship between two Truth [Boolean] conditions And Or

And X And Y is

Or X Or Y is

Select Case Select Case expression Case value code Case value code Case Else code End Select

Option Buttons One and only Value is True per Container Container can be a –Form –Frame

Check Boxes One or more can have the Value Checked –0 unchecked –1 checked –2 grayed

MsgBox Function Resp = MsgBox(“prompt”, vbKeys, “Title”)