© 1992-2011 by Pearson Education, Inc. All Rights Reserved.-Edited By Maysoon Al-Duwais 2.

Slides:



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

Working with Intrinsic Controls and ActiveX Controls
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Microsoft Visual Basic: Reloaded Chapter Five More on the Selection Structure.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
String Variables Visual Basic for Applications 4.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
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.
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
05/09/ Introducing Visual Basic Sequence Programming.
© 1999, by Que Education and Training, Chapter 5, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
Using the Select Case Statement and the MsgBox Function (Unit 8)
Saeed Ghanbartehrani Summer 2015 Lecture Notes #4: Working with Variables and User Interfaces IE 212: Computational Methods for Industrial Engineering.
Chapter 2 User Interface Design Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
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.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 8 Dental Payment Application Introducing CheckBox es and Message Dialogs.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 1B) UTPA – Fall 2011.
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
2-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Decisions and Debugging Part06dbg --- if/else, switch, validating data, and enhanced MessageBoxes.
Input Validation Check the values entered into a text box before beginning any calculations Validation is a form of ‘self-protection’, rejecting bad data.
Class 3 Remote Instruction Computer Math EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
Repetition Statements
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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
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.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 2 User Interface Design.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
ME 142 Engineering Computation I Input, Output & Documentation.
Chapter 6 Looping Structures. Do…LoopDo…Loop Statement Can operate statements repetitively Do intx=intx + 1 Loop While intx < 10 –The Loop While operates.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Craps Game Application Introducing Random-Number Generation and Enum.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 4 Designing the Inventory Application Introducing TextBox es and Button s.
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.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
Visual Basic. The Close Method The Close method is used to close a form. To close a form use the keyword Me to refer to the form. Me.Close()
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 2 Creating Applications with Visual Basic.
 2002 Prentice Hall. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1Introduction 5.2 Essentials of Counter-Controlled Repetition.
Creation of Variables with Numeric, alphanumeric, date, picture, memo data types Constant - A quantity that does not change during the execution of a program.
ME 142 Engineering Computation I Interacting with Spreadsheets.
MsgBox, Input Box Functions Check boxes, radio button MsgBox, Input Box Functions Lab 3 3 Ismail M. Romi: PPU- IT Dept.
1 4.2 Selection Logical Operators. 2 Learning Objectives Explain how the logical operator AND Boolean statements works. Directly testing if text boxes.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
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 PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
3.01 Apply Controls Associated With Visual Studio Form
WEB PROGRAMMING JavaScript.
Chapter 3: Introduction to Problem Solving and Control Statements
Chapter (3) - Looping Questions.
Messages and Input boxes
Decisions and Conditions
Introduction to Programming
Presentation transcript:

© by Pearson Education, Inc. All Rights Reserved.-Edited By Maysoon Al-Duwais 2

 Consider the following problem statement: ◦ Write a program that displays in a TextBox a filled square consisting solely of one type of character, such as the asterisk (*). The side of the square and the character to be used to fill the square should be entered by the user. The length of the side should be in the range 1 to 20. © by Pearson Education, Inc. All Rights Reserved.

 The Assignment Statement is used to assign values to a property of an object such as a control.  The general form of the assignment statement is shown here. Object.Property = Value  Assign a student name to the Text property of the TextBox control named NameTextBox and a student’s major to the TextBox control named MajorTextBox. The assignment statements to do this are: NameTextBox.Text = “Nora Ali" MajorTextBox.Text = “IT"  Notice that the value is enclosed within double-quote marks – this indicates the value is a string of characters and only string data is stored to the Text property of a TextBox control.

The Clear method is used to clear the contents of a TextBox control. The general way to execute a method is shown here: NameTextBox.Clear() Or NameTextBox.text = “”

 Function IsNumeric  which has the following declaration:  Public Function IsNumeric(ByVal Expression As Object) As Boolean  Return boolean value: ◦ True: If it gets number ◦ False: Otherwise

Dim a, b, c, d, e, f, g As Double a = 8.0 b = 3.0 c = 4.0 d = 2.0 e = 1.0 f = a - b + c / d * e ' The preceding line sets f to 7.0. Because of natural operator ' precedence and associativity, it is exactly equivalent to the ' following line. f = (a - b) + ((c / d) * e) Ex:

 The Close method is used to close a form. To close a form use the keyword Me to refer to the form. Me.Close()

 VB will save your project files every time you build or execute a project after your initial save.  VB projects consist of many different files and folders within folders.  Save files as you work by clicking the Save All button on the button toolbar.  DO NOT USE the File-Save As menu at any time to try to save the project – if you do, you will likely only save an individual file, not the entire project, and you will not have a complete project saved.

 BorderStyle property – Labels, TextBox and PictureBox controls all have a BorderStyle property – this property makes controls appear as either flat or three-dimensional.  BorderStyle property -- set to an appropriate value to enhance the appearance of a form and add a professional touch to a project.  BorderStyle property values: ◦ None – flat appearance with no border. ◦ FixedSingle – a flat appearance with black border. ◦ Fixed3D – for a TextBox, this looks about like FixedSingle. For a Label control, the appearance is a three-dimensional, recessed appearance.  The TextBox control default value for BorderStyle is Fixed3D.  The Label and PictureBox controls default value for BorderStyle is None.

Msgbox PromptText Icon Buttons Dialog title

Msgbox -Parameters The message box function takes 3 main parameters: Msgbox (Prompt Text, Buttons+Icon, DialogTitle) [ Prompt : a Text which contains the message. ] Button Constant vbOKOnly vbOkCancel vbYesNo vbYesNoCancel vbAbortRetryIgnore vbRetryCancel Icon ConstantIcon vbQuestion vbInformation vbExclamation vbCritical

Msgbox -Example  MsgBox("Are you sure you would like to close the Program?", vbYesNo + vbExclamation, "Alert")

Random Numbers -Declaration Dim randomNumber As Random = New Random Variable nameData typeInitialization

Random Numbers -Methods  Next()  Non-negative random integer  NextDouble()  A double between 0.0 and 1.0  Next(IntegerValue)  A positive integer < IntegerValue  Next(IntValue1,IntValue2)  IntValue1 <= an integer < IntValue2

Random Numbers -Example Dim randomNumber As Random randomNumber = New Random Dim number As Integer number = randomNumber.Next(12, 20) MsgBox(number)

VbCrLf and vbTab In the case of vbCrLf, the value represented is the combination of the carriage return and linefeed characters, which cause subsequent output to print at the beginning of the next line. The constants vbCrLf and vbTab represent the carriage return/linefeed character and the tab character, respectively.

ComboBox Add a Combobox control Add items to the list assign the choice to a variable choice = comboBox1.Text()