New Project in Visual Basic Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
Using Macros and Visual Basic for Applications (VBA) with Excel
Advertisements

Chapter 2 –Visual Basic, Controls, and Events
The Initial Visual Basic Screen
Introduction to Visual Basic Chulantha Kulasekere.
Muffin Shop - if, calculations etc. (muffins, muffins2) Please use speaker notes for additional information!
Chapter 2 –Visual Basic, Controls, and Events
Clearly Visual Basic: Programming with Visual Basic 2008
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Hello World In C++ and Microsoft Visual C++. Directions to begin a project 1. Go to All Programs 2. Open Visual Studio C++ 3. Click on New Project 4.
InvEasy (Project1) Please use speaker notes for additional information!
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
IE 411/511: Visual Programming for Industrial Applications
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
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.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
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.
Microsoft Visual Basic 2005 CHAPTER 4 Variables and Arithmetic Operations.
Do Loop with Interest Please see 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.
Visual Basic.net Textbox & Label Controls. Textbox Naming convention (txt) Primary use (user input) Can except numeric and character values.
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”
Random Files Please see speaker notes for additional information!
Chapter Two Creating a First Project in Visual Basic.
University of Sunderland CIF 104 Fundamentals of DatabasesUnit 16 SESSION 16 VBA example.
Controls. Adding Controls to Form -You can pick controls from the toolbox. -To add the controls from Toolbox to the Form You have be in design view. -To.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Vocabulary in VB So Far. Assignment: Used to change the value of an object at run time Used to change the value of an object at run time.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
1 Advanced Computer Programming Lab Calculator Project.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
You should unzip and download the beginning programs.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
VB Objects & Events (Exercises) School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 3, Friday 1/31/2003)
Pay Example (PFirst98) Please use speaker notes for additional information!
Visual Basic I/O Programs (ProjRead1, ProjRead2, ProjWrite1, ProjPay) Please use speaker notes for additional information!
This is how you invoke the Microsoft Visual Studio 2010 Software. All Programs >> Microsoft Visual Studio 2010.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
CSC 230 (Blum)1 Visual Basic 2005 Hello World Fall 2005 T. Blum.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Sorry, the pen lost control. Anyway, you need to download both the.vbp and the.frm for each project. I looked at PrCalc, I did not look at inventory.
Using a Database Access97 Please use speaker notes for additional information!
Visual Basic A Quick Tutorial VB Review for ACS 367.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
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.
The Program Editor1 Visual Basic (VB) supports a text editor (not a word processor) that permits the writing and modification of program code. The editor.
IE 411/511: Visual Programming for Industrial Applications Lecture Notes #2 Introduction to the Visual Basic Express 2010 Integrated Development Environment.
I am using Visual Basic 6 for this class. If you want to use a different version, please contact me. Thanks!
21/03/ Working with Controls Text and List Boxes.
Subroutines (PrArith, Math,projCP1, PrAdrProc, PrAdrProcFunc) Please use speaker notes for additional information!
Programming with Visual Basic.NET. Quick Links Program Code The Code Window The Event Procedure Assignment Statements Using AutoList Radio Buttons Buttons.
Chapter 2 - VB 2008 by Schneider1 Chapter 2 –Visual Basic, Controls, and Events 2.1 An Introduction to Visual Basic 2.2 Visual Basic Controls 2.3 Visual.
Using Forms and Form Elements In Visual Basic.NET.
Visual Studio 2010 Hello World CSC 230.
Please use speaker notes for additional information!
Visual Studio 2010 Hello World CSC 230.
Department Array in Visual Basic
Please use speaker notes for additional information!
This is where you can establish the name of the project and the address where it is stored - these are the defaults. If you do not enter anything, the.
If statements (Inven1, Inven2, Inven2a, Inven3, Inven3a)
More on If statements (Calculate, Calculate1, Calculate2)
Understanding Buttons and TextBoxes
Introduction to Visual Basic 2010
Presentation transcript:

New Project in Visual Basic Please use speaker notes for additional information!

New Project This project is called Project1 by default and the form is called Form1 by default. The properties are showing the default properties for the form.

New Project I clicked on Project1 in the Project Window and the project was brought up in the Properties window. I then entered the new name under Name. The project is now called New Project. Notice that it also appears on the window above the form.

New Form I clicked on Form 1 under Forms which is under NewProject and this brought up the properties for the form. I then named the form NewForm.

Putting on a label The first thing I want to put on the form is a label box. I drag and drop and reposition it to the place where I want it. The properties are then used to name the label box and make other property changes. Note that the … when I click on font means that more information is available if you click on the … This brought up the font window.

Another label

Text Box This is a textbox that I named txtFirst. txtFirst was keyed into the Name property which does not show because I have scrolled past it.

Button I have now established a command button which I named cmdCalc. I will now need to write the code to make clicking on cmdCalc cause the addition of the numbers in txtFirst and txtSecond and the display of the answer in txtTotal.

Button - click event The code shown below is the code that will be executed when the Calculate button is clicked. Note that you can see that this is a subroutine that is executed when cmdCalc is clicked and you can also see the button and the event in separate windows.

Run/Execute To Run or Execute, click on Run. The form will come up in Run/Execute mode. I then entered the two numbers and clicked the Calculate button which calculated and showed the results.

ProArith

VB for ProArith

Option Explicit Private Sub cmdAdd_Click() txtTotal = Val(txtNum1) + Val(txtNum2) End Sub Private Sub cmdClear_Click() txtNum1 = " " txtNum2 = " " txtTotal = " " txtNum1.SetFocus End Sub Private Sub cmdDiv_Click() txtTotal = Val(txtNum1) / Val(txtNum2) End Sub Private Sub cmdExit_Click() End End Sub Private Sub cmdMult_Click() txtTotal = Val(txtNum1) * Val(txtNum2) End Sub Private Sub cmdSubt_Click() txtTotal = Val(txtNum1) - Val(txtNum2) End Sub VB Adds the contents of txtNum1 which is converted to a number and txtNum2 which is also converted and assigns the results to the txtTotal box. Sets all of the boxes back to spaces and then sets the focus (puts the cursor) in txtNum1. The End statement will stop the processing of the form. txtNum1 is divided by txtNum2 and the results are assigned to txtTotal. These two events are to multiply and subtract. Note that the multiply uses the *.

Run ProArith The SUBTRACT button was clicked.

ProArith1 Option Explicit Private Sub cmdAdd_Click() txtTotal.Text = Val(txtNum1.Text) + Val(txtNum2.Text) End Sub Private Sub cmdClear_Click() txtNum1.Text = " " txtNum2.Text = " " txtTotal.Text = " " txtNum1.SetFocus End Sub Private Sub cmdDiv_Click() txtTotal.Text = Val(txtNum1.Text) / Val(txtNum2.Text) End Sub Private Sub cmdExit_Click() End End Sub Private Sub cmdMult_Click() txtTotal.Text = Val(txtNum1.Text) * Val(txtNum2.Text) End Sub Private Sub cmdSubt_Click() txtTotal.Text = Val(txtNum1.Text) - Val(txtNum2.Text) End Sub.Text after the textbox name says that we are specifically interested in the Text property of the box.