More Visual Basic!. Creating a Standalone Program A standalone program will allow you to make a program file that can be run like other Windows programs,

Slides:



Advertisements
Similar presentations
VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
Advertisements

Page and Section Breaks, Word 2000
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Excel Project 7 Using Macros and Visual Basic for Applications (VBA) with Excel.
CPIT 102 CPIT 102 CHAPTER 1 COLLABORATING on DOCUMENTS.
Using Macros and Visual Basic for Applications (VBA) with Excel
Using Multiple Forms! Creating a Splash Screen. Uses of Multiple Forms Includes: Dialog Boxes (appear often in Windows Programs) Splash Screen (a window.
Access - Project 1 l What Is a Database? –A Collection of Data –Organized in a manner to allow: »Access »Retrieval »Use of That Data.
Visual Basic Project 1 IDS 306 Spring 1999 V. Murphy.
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
Macros Tutorial Week 20. Objectives By the end of this tutorial you should understand how to: Create macros Assign macros to events Associate macros with.
A Visual Introduction to PC SAS. Start SAS by double-clicking on the SAS icon...
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
Introduction to Visual Basic Chulantha Kulasekere.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
Document Basics Lesson 2. Skills Matrix SKILL #MATRIX SKILL 1.1.2Apply Quick Styles to documents 1.1.3Format documents using themes 1.1.4Customize a theme.
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Microsoft Visual Basic 2005 CHAPTER 12 Cell Phone Applications and Web Services.
Clearly Visual Basic: Programming with Visual Basic 2008
Visual Basic Chapter 1 Mr. Wangler.
Chapter 1 P. 1 Writing Windows applications with Visual Basic Figure 1.1 The first program works as follows: (These operations can be performed in any.
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Using Visual Basic for Applications (VBA) – Project 8.
Microsoft Visual Basic 2005 BASICS Lesson 4 Mathematical Operators.
A First Look At Microsoft Visual Basic Lesson 1. What is Microsoft Visual Basic? Microsoft Visual Basic is a software development tool, which means it.
Review for Mid-term! October 26, Review Homework Worksheet True or False Operators are symbols that perform specific operations in Visual Basic.
Visual Basic.NET BASICS Lesson 4 Mathematical Operators.
Creating a Project with C++ Builder
Basic Controls & Properties Chapter 2. Overview u VB-IDE u Basic Controls  Command Button  Label  Text Box  Picture Box u Program Editor  Setting.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
 Application – another name for a program.  Interface – is what appears on the screen when the application is running.  Program Code – is instructions.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Tutorial 11 Five windows included in the Visual Basic Startup Screen Main Form Toolbox Project Explorer (Project) Properties.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Visual Basic.NET BASICS Lesson 5 Exponentiation, Order of Operations, and Error Handling.
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.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Creating an Application System Using Macros, Wizards, and the Switchboard.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Lesson 4 Mathematical Operators! October 6, 2009.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft® Excel 2013.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Chapter 2 Creating Applications with Visual Basic.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Visual Basic A Quick Tutorial VB Review for ACS 367.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
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.
Lesson 5 Exponentiation,Order of Operations and Error Handling.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
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”
Lesson 4 Mathematical Operators! September 29, 2008 (Pages 62-65)
Visual Basic.NET Windows Programming
Variables and Arithmetic Operations
Introduction to Programming
Presentation transcript:

More Visual Basic!

Creating a Standalone Program A standalone program will allow you to make a program file that can be run like other Windows programs, without Visual Basic being loaded.

Open your last VB program that you have saved to your disk. Choose Make (name of your program) from the File menu. Save to your disk. Choose A:\ Change the file name within the Make Project dialog box to VBStandalone and click the OK button. After the EXE file is created, exit Visual Basic. Double-click the MyComputer icon and open VBStandalone file on your disk.

Performing Calculations in Visual Basic Operators Are symbols that perform specific operations in Visual Basic Statements

Mathematical Operators OperatorDescription =Assignment +Addition -Subtraction *Multiplication /Division \Integer division ModModulus

Creating Label Controls Label Control Is used to place text on a form Sometimes is used to identify a text box Sometimes is used to add a title Sometimes is used to add a message Cannot be changed by user Also can be used to provide output

Creating some labels! 1.Open Visual Basic. 2.Open New Standard EXE project. 3.In the properties window, give the new form the name frmAddition and the caption Addition. 4.Insert a label and click the Caption property. 5.Key in your name for the label. 6.Name your label lblMyName. 7.Save the project with the form named frmAddition and project name Addition.

1.Insert another label on the form. 2.Position it in the center of the form. 3.Change the caption of the label to the number zero (0). 4.Change the name of the new label to lblAnswer. 5.Insert a command button. 6.Name the command button cmdCalculate. 7.Change the button’s caption to Calculate. 8.Add code in code view window. lblAnswer.Caption = Close the code view window and run your program.

Using Text Boxes and the Val Function Text boxes Are the fields placed on dialog boxes and in other windows that allow the user to enter a value. The text property of a text box specifies what text will appear on the text box.

Text –vs-Numeric Data Text Boxes Accept data from the user. Comes in the form of text. Includes letters, symbols, and numbers. Numeric Data Numbers in a text box must be converted to a true numeric value before they can be used in a calculation. The conversion used to convert to numbers is the Val Function!

The Val Function Takes numbers that are in a text format and returns numeric value that can be used in calculations. Example: lblTotal.caption = Val(txtPrice.Text) + Val(txtSalesTax.Text)

Splitting Code Statements Among Lines When splitting a line of code among two or more lines use a underscore (_)! Example: lblTotal.caption = Val(txtPrice.Text)+_ Val(txtSalesTax.Text) The underscore is called _______?_______ and it tells the compiler to skip to the next line and treat the text there as if it were part of the same line.

Comments! The apostrophe ( ‘ ) at the beginning of the code tells the compiler to ignore everything that follows. Example: ‘ Calculate total expenses.

Profit and Loss Program 1.Open your profit&loss program. * Need to make an adjustment before we begin to type code. We need to change some of the text boxes to labels before we continue.

Name your labels, command buttons, and text boxes. See handout! Double-click the Calculate button. Add code to Calculate the total expense. 'Calculate Total Expenses lblTotalExp.Caption = Val(txtRent.Text) + Val(txtPayroll.Text) + _ Val(txtUtil.Text) + Val(txtSupp.Text) + Val(txtOther.Text)

3.Add code to calculate profit. 'Calculate Profit lblProfit.Caption = Val(txtRev.Text) - Val(lblTotalExp.Caption) 4.Add code to calculate loss. 'Calculate Loss lblLoss.Caption = -Val(lblProfit.Caption)

5.Add code to calculate expense percentages. 'Calculate Expense Percentages lblRentPerc.Caption = Fix(Val(txtRent.Text) / _ Val(lblTotalExp.Caption) * 100) lblPayrollPerc.Caption = Fix(Val(txtPayroll.Text) / _ Val(lblTotalExp.Caption) * 100) lblUtilPerc.Caption = Fix(Val(txtUtil.Text) / _ Val(lblTotalExp.Caption) * 100) lblSuppPerc.Caption = Fix(Val(txtSupp.Text) / _ Val(lblTotalExp.Caption) * 100) lblOtherPerc.Caption = Fix(Val(txtOther.Text) / _ Val(lblTotalExp.Caption) * 100)

6.Add code to exit button. END 7. Save your program. 8. Run your program. 9. Key the following data into the your program. Rent350 Payroll 600 Utilities200 Supplies 100 Other50

10.Debug your program if needed. 11.Insert your name. 12.Print your program (all 3 copies). 13.Turn in your program for credit. The End!

Homework! 1.Page 78 – True and False questions. 2.Page 78 – Written Questions. 3.Study for Quiz on Friday!