Managing Controls Lab 2 2 All Rgihs ReservedIsmail M. Romi – PPu: IT DEpt.

Slides:



Advertisements
Similar presentations
Introduction to Programming and Visual Basic 2005
Advertisements

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 STARTING OUT WITH Visual Basic 2008 FOURTH EDITION Tony Gaddis.
Information System Design Lab 5&6. User Interface Design.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Introduction to Programming and Visual Basic
Creating an OOED Application
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
Excel and VBA Creating an Excel Application
1 Pertemuan 02 Visual Basic Environment and Control Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab2 Managing Controls.
Chapter 1 Introduction to Programming and Visual Basic 2005 Lecture Notes Chapter 1 (CSIT 105)
Chapter Introduction to Programming and Visual Basic
Introduction to Programming and Visual Basic
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Programming and Visual Basic.
CSCI Programming with Visual Basic Instructor: Bindra Shrestha University of Houston – Clear Lake.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Chapter 8: String Manipulation
Slide Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter Introduction to Programming and Visual Basic
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic Chapter 1 Mr. Wangler.
BIM313 – Advanced Programming Simple Controls 1. Contents Traditional Controls – Labels, Text Boxes, Buttons, Check Boxes, List Boxes, Combo Boxes Advanced.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Overview-An Overview of Visual Basic.NET1 An Overview of Visual Basic.NET.
Chapter 4: The Selection Structure
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
Problem Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly pay rate.
CIS 115 Lecture 4.  Create a Windows-based application that will calculate the Gross Pay earned for a worker, given the number of hours worked and hourly.
Intro to Programming and Visual Basic .NET
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 2 Creating a User Interface.
Visual Basic Week 2
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Starting Out with Visual Basic.NET 2 nd Edition Chapter 1 Introduction to Programming and Visual Basic.NET.
Copyright © 2014 Pearson Education, Inc. Chapter 1 Introduction to Programming and Visual Basic.
Chapter Two Designing Applications Programming with Microsoft Visual Basic th Edition.
CHAPTER TWO Creating Simple Visual Basic.NET Windows Applications.
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”
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
Chapter Two Creating a First Project in Visual Basic.
COPYRIGHT 2007: Dr. David Scanlan, CSUS 010-HELLO WORLD VB-Express.ppt Purpose: A "Hello World" program's purpose is to eliminate as much complexity as.
CC111 Lec7 : Visual Basic 1 Visual Basic(1) Lecture 7.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Copyright © 2011 Pearson Addison-Wesley What is a Program Made Of? Keywords (Reserved Words) – Words with special meaning that make up a high-level programming.
Visual Basic Programming Introduction VB is one of the High level language VB has evolved from the BASIC language. BASIC stands for Beginners All-purpose.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 1 Introduction to Programming and Visual Basic.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Steps for Developing a Visual C# 2010 Application MIT By: S. Sabraz Nawaz.
Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 2 The Visual Basic.NET Integrated Development Environment.
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 1 Introduction to Programming and Visual Basic.
Visual Basic.NET Windows Programming
Introduction to Programming and Visual Basic
Chapter 1: An Introduction to Visual Basic 2015
Introduction to Computer CC111
Introduction to Programming and Visual Basic 2008
1. Introduction to Visual Basic
An Introduction to Computers and Visual Basic
Introduction to Programming and Visual Basic
Introduction to Programming and Visual Basic
CIS16 Application Development Programming with Visual Basic
STARTING OUT WITH Visual Basic 2008
CIS 16 Application Development Programming with Visual Basic
An Introduction to Computers and Visual Basic
Presentation transcript:

Managing Controls Lab 2 2 All Rgihs ReservedIsmail M. Romi – PPu: IT DEpt

Properties Set of attributes for each object used in VB, that changes the appearance and behavior of a Form or Control. Properties Types: 1- Design-time properties: properties than can be changed at the design mode. 2- Run-time properties: properties that can be changed at the run-time

Properties… Cont. Notes: The Form’s Name property should be unique in the project. The Control’s Name property should be unique on the same form. Name property can be changed at the design mode only.

The Form’s Properties Text: The text that appears in form's title bar.. Icon: Displays an icon when the form is minimized. Picture: Image placed as a background to the form. Changing Form Properties at Run-Time: Syntax: Me.PropertyName = Value Examples: Me.Text = "student record" Me.BackColor = Color.Red

Form Events Load : Occurs during loading the form into main memory. Unload : Occurs when removing the form from main memory. Note: You can find all form and other Control’s events in the code window in the events ComboBox.

The Pointer Tool The pointer tool is not a control. This tool used to deselect any selected control in the toolbox

The Label Control A control that displays un editable text to the user. This control used to: 1- Provide a heading or description on the form. 2- Identify another control.

Changing Control Properties at Run-Time Syntax: Me.ControlName.Property = Value Example: Me.Label1.Text = "StudentName:“ Me.Label1.forecolor= color.red

The Text Box Control A control used for accepting user input, and displaying text at the run-time. Properties: MaxLength: determines the maximum number of characters.(0:open). Multiline: (True/False), enables word wrap. Scrollbars: (0:no, 1:Horizontal, 2:Vertical, 3:Both), enables the user to scroll the text. Scrollbars related with multiline

Text Box Properties..[CONT] Locked: True/False Passwordchar: Determines the character that appears when the user enters a text. Text: Specifies the initial text that appears in the text box.

Text Box Events TextChanged: Occurs when the vale of the text property is modified. Keypress, Keydown, Keyup…. Focus: The currently selected control. Gotfocus Event: Occurs when the control have the focus. Lostfocus:

Button Control A control that represents a button. The user press or clicks to initiate an action. Properties Text: Specifies the text that appears in the button. When you precede a letter with &, that letter becomes the accelerator key. Events: Click, Dbclick……..

The Programming Process  The Programming Process Consists of Several Steps, Which Include Design, Creation, Testing, and Debugging Activities  The following is an example of programming process.

Clearly define what the program is to do For example, the Wage Calculator program: Purpose: To calculate the user’s gross pay Input: Number of hours worked, hourly pay rate Process: Multiply number of hours worked by hourly pay rate (result is the user’s gross pay) Output: Display a message indicating the user’s gross pay Step 1 of Developing an Application

Visualize the application running on the computer and design its user interface Step 2 of Developing an Application

Make a list of the controls needed Step 3 of Developing an Application TypeNameDescription TextBoxtxtHoursWorkedAllows the user to enter the number of hours worked. TextBoxtxtPayRateAllows the user to enter the hourly pay rate LabellblGrossPayDisplays the gross pay, after the btnCalcGrossPay button has been clicked ButtonbtnCalcGrossPayWhen clicked, multiplies the number of hours worked by the hourly pay rate ButtonbtnCloseWhen clicked, terminates the application Label(default)Description for Number of Hours Worked TextBox Label(default)Description for Hourly Pay Rate TextBox Label(default)Description for Gross Pay Earned Label Form(default)A form to hold these controls

Define values for each control's relevant properties: Step 4 of Developing an Application Control TypeControl NameText Form(Default)"Wage Calculator" Label(Default)"Number of Hours Worked" Label(Default)"Hourly Pay Rate" Label(Default)"Gross Pay Earned" LabellblGrossPay"$0.00" TextBoxtxtHoursWorked"" TextBoxtxtPayRate"" ButtonbtnCalcGrossPay"Calculate Gross Pay" ButtonbtnClose"Close"

List the methods needed for each control: Step 5 of Developing an Application MethodDescription btnCalcGrossPay_ClickMultiplies hours worked by hourly pay rate These values are entered into the txtHoursWorked and txtPayRate TextBoxes Result is stored in lblGrossPay Text property btnClose_ClickTerminates the application

Create pseudocode or a flowchart of each method: Pseudocode is an English-like description in programming language terms A flowchart is a diagram that uses boxes and other symbols to represent each step Step 6 of Developing an Application Start End Multiply hours worked by hourly payrate. Store result in sngGrossPay. Copy value in sngGrossPay to lblGrossPay text property

Check the code for errors: Read the flowchart and/or pseudocode Step through each operation as though you are the computer Use a piece of paper to jot down the values of variables and properties as they change Verify that the expected results are achieved Step 7 of Developing an Application

Use Visual Basic to create the forms and other controls identified in step 3 This is the first use of Visual Basic, all of the previous steps have just been on paper In this step you develop the portion of the application the user will see Step 8 of Developing an Application

Use Visual Basic to write the code for the event procedures and other methods created in step 6 This is the second step on the computer In this step you develop the methods behind the click event for each button Unlike the form developed on step 8, this portion of the application is invisible to the user Step 9 of Developing an Application

Attempt to run the application - find syntax errors Correct any syntax errors found Syntax errors are the incorrect use of an element of the programming language Repeat this step as many times as needed All syntax errors must be removed before Visual Basic will create a program that actually runs Step 10 of Developing an Application

Run the application using test data as input Run the program with a variety of test data Check the results to be sure that they are correct Incorrect results are referred to as a runtime error Correct any runtime errors found Repeat this step as many times as necessary Step 11 of Developing an Application

Lab Training Design a VB project to perform the following: Accept two numbers in text boxes. Add two command buttons: Add, End When you click Add, the result of addintion should appear in a label control. When you click End the program end.

Questions Design a VB project to: Calculate student average for three grades. Use three buttons : 1 st one for new 2 nd calculate 3 rd close You have to follow the solution steps.

Lab 2 End