Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________.

Slides:



Advertisements
Similar presentations
Chapter 6 - VB 2005 by Schneider1 Do Loop Syntax Do While condition statement(s) Loop Condition is tested, If it is True, the loop is run. If it is False,
Advertisements

Chapter 4 Decisions and Conditions Programming In Visual Basic.NET.
MIS 3200 – Unit 4 Complex Conditional Statements – else if – switch.
Chapter 51 ElseIf clause If condition1 Then action1 ElseIf condition2 Then action2 ElseIf condition3 Then action3 Else action4 End If.
Mark Dixon, SoCCE SOFT 131Page 1 04 – Information Processing: Expressions, Operators & Functions.
Chapter 5 - VB.Net by Schneider
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.
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.
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.
PHP : Hypertext Preprocessor
CIS 451: ASP.NET Debugging and Server-Side Includes Dr. Ralph D. Westfall February, 2009.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Let’s get started using Visual Basic!. Private Sub cmdGo_Click... Dim strMessage As String Dim sngSum As Single If IsNumeric(txtNumber1.Text) = False.
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.
Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks 5.3 Select Case Blocks.
Chapter 4 - VB 2008 by Schneider1 Chapter 4 – Decisions 4.1 Relational and Logical Operators 4.2 If Blocks 4.3 Select Case Blocks.
Chapter 5 - VB 2005 by Schneider1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks 5.3 Select Case Blocks 5.4 A Case Study: Weekly.
1 Lecture 7 – Decision & Conditions Decisions 決定 +Relational and Logical Operators +If 假如, 如果.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Chapter 5 - VB 2005 by Schneider1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks.
New Project in Visual Basic Please use speaker notes for additional information!
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
Class 3 Remote Instruction Computer Math EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is.
Applications Development
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
22/11/ Selection If selection construct.
1 Advanced Computer Programming Lab Calculator Project.
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 2 More Controls.
VAT Calculator program Controls Properties Code Results.
Pay Example (PFirst98) Please use speaker notes for additional information!
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.
1 CS 106 Computing Fundamentals II Chapter 210 “Adding Controls to User Forms” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
1 Chapter 4 – Decisions 4.1 Relational and Logical Operators 4.2 If Blocks 4.3 Select Case Blocks 4.4 Input via User Selection.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
31/01/ Selection If selection construct.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
2c – Textboxes and Buttons Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Using a Database Access97 Please use speaker notes for additional information!
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.
Knowledge Base. Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
Using Forms and Form Elements In Visual Basic.NET.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Computer Science Up Down Controls, Decisions and Random Numbers.
Chapter 4 - VB 2008 by Schneider1 Chapter 4 – Decisions 4.1 Relational and Logical Operators 4.2 If Blocks 4.3 Select Case Blocks.
1 Chapter 5 – Decisions 5.1 Relational and Logical Operators 5.2 If Blocks 5.3 Select Case Blocks 5.4 A Case Study: Weekly Payroll.
Week 4 Relational and Logical Operators Dr. Jennifer Cunningham.
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
Chapter 4 - VB 2008 by Schneider
3rd prep. – 2nd Term MOE Book Questions.
3rd prep. – 2nd Term MOE Book Questions.
MIS 3200 – Unit 4 Complex Conditional Statements else if switch.
Visual Basic..
Department Array in Visual Basic
Chapter (3) - Looping Questions.
The List Box Control Items can be placed into the list at design time or run time The Sorted property causes items in the list to be sorted automatically.
Introduction to TouchDevelop
Additional Topics in VB.NET
SELECTIONS STATEMENTS
Final Revision sheet- term2
Final Revision sheet- term2
Presentation transcript:

Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________ Which control will you use for user to choose the kinds of fruit he/she likes, e.g. Apple, Banana, Orange? ____________ Name ______________ No _____ Class _______ (PA)

Revision Exercise: Concatenation Write code to join the text string so that txtResult will look like as below? PeterChan txtFirstName txtLastName txtResult My Name is Peter Chan. txtResult txtResult.text = “My Name is ” Name ______________ No _____ Class _______ (PA)

Revision Exercise: Symbol Which symbol is used to enclose a text string in code, e.g. “Hello World” and then assign it to a textbox? ____________ Which symbol can be used to write a non-executable comment? ____________ Which symbol will you use to break a long statement into different lines? ____________ Name ______________ No _____ Class _______ (PA)

Revision Exercise: Code 1. Write code to assign “Peter” into a textbox? txtName Peter = txtName 2. Write code to end a program? 3. Write code to reset the insertion point in a textbox? Name ______________ No _____ Class _______ (PA)

Exercise n = 4, answ = “Y” Are the following conditions true or false? Not (n < 6) (answ = "Y") Or (answ = "y") (answ = "Y") And (answ = "y") Not(answ = "y") True/False Name ______________ No _____ Class _______ (PA)

Exercise Determine whether the following conditions are true or false. Let a = 2, b = 3 1.(5 – a) * b < 7 2.NOT (a < b) 3.(a * a < b) OR NOT (a * a < a) True/False Name ______________ No _____ Class _______ (PA)

Exercise Determine whether the following conditions are true or false. Let a = 2, b = 3 1.“Inspector” < “gadget” 2.a <> b 3.((a=b) OR NOT (b < a)) AND ((a < b) OR (b = a + 1)) True/False Name ______________ No _____ Class _______ (PA)

Exercise: Find the larger number (1) This application is used to find a bigger number. After you have entered 2 numbers into the first two textboxes and have clicked the button, the bigger number will then be displayed in the last textbox. In VS.NET 2003, which area should you double click and put the code inside? Name ______________ No _____ Class _______ (PA)

In VS.NET 2003, which area should you put the code inside? Line Don’t change! Line 144 Line 3 Name ______________ No _____ Class _______ (PA)

Fill in the blanks: Hints: Label1, Label1.text, txtNum1, txtNum1.Text, txtNum2, txtNum2.Text, txtResult, txtResult.Text, num1, num2, largerNum, CInt, CDec, Interger, Double, Decimal, Date Dim num1, num2, largerNum As ____________ num1 = CDec(____________) num2 = CDec(txtNum2.Text) If num1 > num2 Then _________ = num1 Else largerNum = ______ End If txtResult.Text = _The larger number is " __ __________ Exercise: Find the larger number (3) txtNum1 txtNum2 txtResult Name ______________ No _____ Class _______ (PA)

Exercise: Determine what output will be displayed in the text box when the button is clicked. Private Sub btnDisplay_Click (…) Handles btnDisplay.Click Dim gpa As Double = 3.49 txtOutput.Clear() If gpa >=3.5 Then txtOutput.Text = “Good” End If txtOutput.Text = txtOutput.Text & “ Student” End Sub What is the output result of the text box? Name ______________ No _____ Class _______ (PA)

Compound Conditions If radMale.Checked = True And CInt(txtAge.Text) < 21 Then … ‘Will the program continue to run … End If Situation True/False radMale not checked txtAge greater than 21 radMale not checked, txtAge less than 21 radMale checked, txtAge 21 or greater radMale checked, txtAge less than 21 Name ______________ No _____ Class _______ (PA)

Compound Conditions If radJunior.Checked = True Or radSenior.Checked = True Then … ’Will the program continue to run … End If Situation True/False radJunior.Value=True radSenior.Value=True radJunior.Value=False, radSenior.Value=True radJunior.Value=True, radSenior.Value=False radJunior.Value=False, radSenior.Value=False Name ______________ No _____ Class _______ (PA)