Free Essay

Visual Basic Calculater

In: Computers and Technology

Submitted By daveB
Words 858
Pages 4
Public Class Form1 Dim m, num, count As Double

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click TextBox1.AppendText("7")

End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click TextBox1.AppendText("9")

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

TextBox1.AppendText("1")

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.AppendText("2") End Sub

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click TextBox1.AppendText("3") End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox1.AppendText("4")

End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click TextBox1.AppendText("5")

End Sub

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click TextBox1.AppendText("6")

End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click TextBox1.AppendText("8")

End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click TextBox1.AppendText("0")

End Sub

Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click

Label3.Text = "+" 'Addition Operation If TextBox2.Text = "" Then TextBox2.Text = TextBox1.Text + " + " TextBox1.Text = "" Else : TextBox2.Text = TextBox2.Text + " + " End If

End Sub

Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click TextBox2.Text = Math.Sqrt(Val(TextBox2.Text)) ' Gives the Squarroot of a number

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged

End Sub

Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click Label3.Text = "-" 'Subtraction Operation If TextBox2.Text = "" Then TextBox2.Text = TextBox1.Text + " - " TextBox1.Text = "" Else : TextBox2.Text = TextBox2.Text + " - " End If

End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click Label3.Text = "*" 'Multipacation Operation If TextBox2.Text = "" Then TextBox2.Text = TextBox1.Text + " * " TextBox1.Text = "" Else : TextBox2.Text = TextBox2.Text + " * " End If

End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click Label3.Text = "/" 'Divison Operation If TextBox2.Text = "" Then TextBox2.Text = TextBox1.Text + " / " TextBox1.Text = "" Else : TextBox2.Text = TextBox2.Text + " / " End If

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click

If Label3.Text = "+" Then 'Addition Function TextBox2.Text = Val(TextBox2.Text) + TextBox1.Text ElseIf Label3.Text = "-" Then 'Subtraction Function TextBox2.Text = Val(TextBox2.Text) - TextBox1.Text ElseIf Label3.Text = "*" Then 'Multiplacation Funtion TextBox2.Text = Val(TextBox2.Text) * TextBox1.Text Else 'Divison Funtion If TextBox1.Text = 0 Then TextBox2.Text = "Error can not divide by 0" 'Test for Division by Zero Else

TextBox2.Text = Val(TextBox2.Text) / TextBox1.Text End If End If

End Sub

Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click TextBox2.Text = Val(TextBox2.Text) / 100 'Gives the percent of a number

End Sub

Private Sub Button27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button27.Click TextBox1.Text = "" TextBox2.Text = "" ' Clears Both textboxes

End Sub

Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click TextBox1.Text = "" 'Clears Textbox1

End Sub

Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click

If TextBox1.Text = "" Then Exit Sub Else TextBox1.Text = CStr(TextBox1.Text) TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Length - 1) ' Erases the last number End If

End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click m = TextBox2.Text 'Saves a number to Memory

End Sub

Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click TextBox1.AppendText(".") End Sub

Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click

TextBox1.Text = CDbl(TextBox1.Text) * -1 'Changes a number between positive and negitive

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click m = 0 'Clears Memory

End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click TextBox2.Text = m 'Recalls what is in Memory

End Sub

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click m = m + Val(TextBox2.Text) 'Adds a number to number in memory

End Sub

Private Sub Button28_Click(sender As Object, e As EventArgs) Handles Button28.Click m = m - Val(TextBox2.Text) 'Subtracts a number to number in memory

End Sub

Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click TextBox1.Text = 1 / TextBox1.Text ' Gives the reciprical of a number

End Sub
End Class

Similar Documents

Free Essay

Sales and Inventory System

...Rica A. Hernandez BSCS 2101 Start Microsoft Visual Basic 6.0 (VB6) The New Project dialog box will appear. If it doesn't go up to the menu bar and select File -> New Project In the New Project dialog select Standard EXE, and click the Open Button. This will bring up your new Project 1 application with Form1 visible. Already Visual Basic has done a lot for us. As you can see this tutorial isn't very long but already you have a full working application. You can see your new program in action by going up to the menu bar and selecting Run -> Start (Or simply press the F5 key). You should see the Form1 window appear: This is a fully functional application. You can move it around, minimize and maximize it, and close it down. For you to do this same thing in C++ - the original language most of Windows was written in you would have written hundreds of lines of code. You area already getting to see some of the extreme power VB gives you. Now lets continue with the tutorial.  Lets make this program say hello! On the left side of the screen you can see the toolbox (if this doesn't show up go to the top menu bar and select View -> Toolbox). In this toolbox you will see a picture of a button. Double click the button icon and it will create a Command1 CommandButton in the center of your form.    If you run the program now (Press F5) you will see your window now has a button labeled Command1 in the center of it, but if you click the button it doesn't do anything...

Words: 628 - Pages: 3

Free Essay

Management Information System

...酒店管理系统是较为典型的管理信息系统,系统的开发主要包括前端的程序开发和后台数据库的建立和维护。数据库要求具有一致性、完整性、数据安全性好的特点,而前端的程序要求功能完备,使用便捷。 本系统使用MICROSOFT公司的Visual Basic 6.0和ACCESS 2000作为程序开发工具和数据库开发工具。主要包括预订管理,接待管理,收银管理,系统管理,客房管理等功能模块。设计首先在短时间内建立起系统应用的原型, 然后对原型系统进行需求分析, 并不断修正和改进, 直到最终形成用户满意的可行性系统。系统的难点在于数据库的设计和模块之间的动态连接。因为时间和能力的原因,目前本系统的设计为单机版,在论文的第6章有关于网络版的部分构思。 关键字:管理信息系统 BASIC 6.0 ACCESS 2000 窗体 ABSTRACT The system of hotel management is a typical application of management information system(MIS),which mainly includes building up data-base of back-end and developing the application interface of front-end. The former should make the application powerful and easily used. The later required consistency and integrality and well security of data. This system uses Visual Basic 6.0 and the ACCESS 2000 presented by Microsoft Company. Including the pre-arranged management primarily, reception management, system management, guest room management etc. function mold piece. It can give you a short-cut to build up a prototype of system application. The prototype could be modified and developed till users are satisfied with it. The design of this system is a single machine version, there are a outline concerning network in the section six. Key words: Management information system(MIS) VISUAL BASIC 6.0 ACCESS 2000 FORM 目 录 前言 ......

Words: 2237 - Pages: 9

Free Essay

Chapter of My...

...computer. The program is also robust; phpMyAdmin has enough functionality that you can probably create and run a Web site without knowing any SQL. Being free and open-source never hurt anybody, either. For these reasons, most hosting sites include phpMyAdmin in their control panel as the default MySQL administration tool. phpMyAdmin has some nice extras, such as importing and exporting Excel, OpenDocument, and XML files, and a tool that generates a PDF image of your database schema. Visual Basic  According to Laud (2012) Visual Basic is a programming language and integrated development environment (IDE). It derives from the much older BASIC programming language, and so is considered a useful and relatively easy programming language for the beginner to learn. Visual Basic (VB) is now integrated into many different software applications and also web applications. Visual Basic was developed to be easy to learn, with a quick learning curve and a diverse scope of possibilities. Using the Visual Basic software, you can either hard-code or use the developer software to assist you throughout. It's also used to create ActiveX controls (for web usage and other controls), .dll file extensions or executables for standalone operation. LAN (Local Area Network) According to Rouse (2006) a local area network (LAN) is a group of computers and associated...

Words: 1499 - Pages: 6

Premium Essay

Pt1420

...Lab 4.1 – Pseudocode and Modules (“UTP Installed”) Critical ReviewA Module is a group of statements that exists within a program for the purpose of performing a specific task.Modules are commonly called procedures, subroutines, subprogram, methods, and functions.The code for a module is known as a module definition. To execute the module, you write a statement that calls it.The format for a module definition is as follows:Module name()StatementStatementEtc.End ModuleCalling a module is normally done from the Main() module such as:Call name()Generally, local variables should be used and arguments should be passed by reference when the value of the variable is changed in the module and needs to be retained. For example:Module main()Real Integer numberCall inputData(number)Call printData(number)End Module// Accepts number as a reference so that changed value// will be retainedModule inputData(Real Ref number)number = 20End Module// number does not need to be sent as reference because// number is not going to be modifiedModule printData(Real number)Display “The number is “, numberEnd Module | This lab requires you to think about the steps that take place in a program by writing pseudocode. Read the following program prior to completing the lab. Data Communications Corp wants a small program that will calculate the cost of UTP it installs for their clients. Write a program that will ask the user to input the name of the client, the number of feet of cable installed. The......

Words: 1808 - Pages: 8

Free Essay

Vp Short Report

...‘Visual Basic’ Developer: Microsoft Appeared in: 1991; 24 years ago OS: Microsoft Windows and Ms - DOS HISTORY: Alan Cooper, the 'father' of Visual Basic, shows a drag-and-drop shell prototype called Tripod to Bill Gates. Microsoft negotiates to buy the concept, now code-named Ruby. The Tool includes a widget control box, the ability to add widgets dynamically, and a small language engine. Visual Basic is Microsoft's high-level object-oriented rapid application development environment for the Windows platform. The first versions of Visual Basic were intended to target Windows 3.0 (a version for DOS existed as well), however it was not until version 3.0 for Windows 3.1 that this programming language gained large-scale acceptance in the shareware and corporate programming community. VB 1.0 was introduced in 1991. The approach for connecting the programming language to the graphical user interface is derived from a system called Tripod (sometimes also known as Ruby), originally developed by Alan Cooper, which was further developed by Cooper and his associates under contract to Microsoft. Visual Basic is a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. Microsoft intended Visual Basic to be relatively easy to learn and use. Visual Basic was derived......

Words: 1610 - Pages: 7

Premium Essay

The History of Visual Basic

...The History of Visual Basic dates back to 1991 when VB 1.0 was introduced. The core of Visual Basic was constructed on the older BASIC language, which was the prevalent programming language throughout the 1980s. It's a computer programming system established and owned by Microsoft. Visual Basic was originally produced to make it easier to write programs for the Windows computer operating system. The basis of Visual Basic is an earlier programming language called BASIC that was invented by Dartmouth College professors John Kemeny and Thomas Kurtz. Visual Basic is often denoted by using just its initials; VB. Visual Basic is easily the most extensively used computer programming system in the history of software. Microsoft Visual Basic is the most common language and development environment for developers coding to the Windows operating system platform. From modest beginnings it has grown to be part of personal computing itself, and with the latest incarnation, Visual Basic .NET in Beta it looks as if it may be in use for another decade or longer. Visual Basic 1.0 for Windows was released in May 1991 at a trade show in Atlanta, Georgia. Visual Basic 2.0 was released in November 1992. The programming environment was easier to use, and its speed was improved. Visual Basic 3.0 was released in 1993 and came in Standard and Professional versions. Visual Basic 4.0 was released in August 1995. It was the first version that could produce 32-bit as well as 16-bit Windows programs.......

Words: 409 - Pages: 2

Free Essay

Art History

...OMIS 462 Spring 2013 Visual Basic Assignment 4 Due: April 25rd 100 points Title: University Book Store Learning Objectives After completing this project, you will be able to: 1. Create a database in VB, use the data in an application, and create queries. 2. Build an application using multiple forms, and pass data between forms. Description Build a simple University Bookstore system. This system will have a one-table Inventory database for books. For this system, each book will have only one author. Here are the main things you must do in your application: 1. Using the Golf Tutorial as a guide, create a database containing an Inventory table. The inventory table should have the following attributes: BookID, Title, Author (just last name), ISBN and edition. Enter data for at least 5 books. Include two books written by Dickens, and at least three others of your choice. 2. Create a query to allow the user to enter the author name to find all books by that author. 3. The first form should allow the user to search for the author by name (the query created above), displaying all the details except BookID. Once the user finds the desired book, the user should be able to click a button to put the selected book on a book order on a new form. Also add a Quit button. 4. On the order form, display the values shown. Have a button to Place the Order. Clicking this button should display a “Thank you for your order”......

Words: 403 - Pages: 2

Free Essay

Vb, Net

...HND Division Head Office - IDM Nations Campus HND in Computing & Systems Development Unit 42 - Programming in .NET (June 2013) Set By : Mr. Sanaka Suranga Perera Student Name: Student Number: Edexcel Registration No: Date Released: 02/04/2013 Branch Name : Due Date: 31/05/2013 Submitted Date: Here by I confirm that this is my own work and that I have not plagiarized any part of it. I have also noted the assessment criteria of the assignment. Student Signature : Outcomes/Grade Descriptors Achieved (Please Tick) |Outcomes/ Grade |P42.1 |P42.2 |P42.3 |P42.4 | |Descriptors | | | | | | |1.1 |1.2 | |P42.1.1discuss the principles, |Include features ,principals of .NET framework(Task 1-a) | | |characteristics and features of | | | |programming using a .NET framework | | | |P42.1.2 critically compare different types|Differentiate the .NET versions (Task 1 -b) | ...

Words: 1224 - Pages: 5

Free Essay

Pt1420

...address, city, state, zip Display “Enter your telephone number” Input Telephone number Display “Enter college major” Input college major Input Information Console.Write("Enter your full name: ") name = Console.ReadLine() Console.Write("Enter your address, city, state, and zip: ") addressCityStateZip = Console.ReadLine() Console.Write("Enter your Telephone Number: ") telephoneNumber = Console.ReadLine() Console.Write("Enter your College Degree: ") collegeDegree = Console.ReadLine() Visual Basic Code: Sub Main() 'Declarations for variables Dim name As String Dim addressCityStateZip As String Dim telephoneNumber As String Dim collegeDegree As String 4) Total Purchase A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6%. Visual Basic Code: Console.Title = "Total Purchase" Console.WriteLine("Input the amount of each item purchased") Console.WriteLine("Item 1") Dim Num1 As Double Num1 = Console.ReadLine() Console.WriteLine("Item 2") Dim Num2 As Double Num2 = Console.ReadLine() Console.WriteLine("Item 3") Dim Num3 As Double Num3 = Console.ReadLine() Console.WriteLine("Item 4")...

Words: 290 - Pages: 2

Free Essay

Werwqewq

...Being a CCNA certified and thre benefits CCNA is one of the most vouched and valued IT certification throughout the world. Cisco certifications have benefited both the employee as well as the employer. It is a known fact that many people have literally changed their lives and have got real benefits and acquired valuable skills in the process of becoming certified. In the process of getting your CCNA certification you are sure to increase your knowledge base and understanding of the concepts. . In the process of getting certified you would be bombarded with many advancements of the industry thus increasing your overall knowledge. CCNA Certification increases your chances of promotion. You could expect to move up in the hierarchy of your organization. Getting a CCNA certificates commands a certain amount of respect from your colleagues and employer. Some of your colleagues would have also tried to get certified, but could not get certified. So, this achievement of yours deserves a back-patting. You always wanted to get certified, so after you receive your certification letter and other stuff, a sense of personal satisfaction, gratification, and relief is felt. Those were some of the benefits that you could receive after getting CCNA certified. Top 10 best free web design software 1. Coffeecup html editor 2. Notepad++ 3. Pagebreeze 4. Firebug 5. Bluefish editor 6. Brackets 7. kompoZer 8. openBexi 9. GIMP 10. Bluegriffon The......

Words: 541 - Pages: 3

Free Essay

Asp.Net Application for Book Doisplay

...value; } } public Book1(string p1,string p2,string p3,double p4) { // TODO: Complete member initialization this.isbn = p1; this.title = p2; this.author = p3; this.buyprice = p4; } } public partial class display : System.Web.UI.Page { private ArrayList books; String txt; String bookname; String bookauthor; double price; protected void Page_Load(object sender, EventArgs e) { books = new ArrayList(); BookDetails(); } private void BookDetails() { Book1 b1 = new Book1("978-1449311520", "adoop: The Definitive Guide", "Tom White", 15.99); Book1 b2 = new Book1("978-0735667044", "Microsoft Visual Basic 2013 Step by Step", "Michael Halvoson", 9.50); Book1 b3 = new Book1("978-0993088100", "Fifty Quick Ideas to Improve Your User Stories", "David Evens/Gojko Adzick", 33.00); Book1 b4 = new Book1("978-1428336117", "The Medical Manager Student Edition", "David Fitzpatrick", 99.00); Book1 b5 = new Book1("978-0769302652", "Introduction to Language Development", "Scott McLaughlin", 55.00);...

Words: 773 - Pages: 4

Premium Essay

Unit 3

...Lab 3: Input, Processing, and Output This lab accompanies Chapter 2 (pp. 56-68) of Starting Out with Programming Logic & Design. Chris Garcia Name: ___________________________ Lab 3.1 – Pseudocode This lab requires you to think about the steps that take place in a program by writing pseudocode. Read the following program prior to completing the lab. Write a program that will take in basic information from a student, including their name and how many credits they have taken in Network Systems Administration program. The program will then calculate how many credits are needed to graduate. Display should include the student name and the number of credits left to graduate. This should be based off a 90 credit program, where some courses are half credits. Step 1: This program is most easily solved using just a few variables. Identify potential problems with the following variables declared in the pseudocode. Assume that the college has the ability to offer half credits. (Reference: Variable Names, page 39-40). |Variable Name |Problem (Yes or No) |If Yes, what’s wrong? | |Declare Real creditsTaken |n | | |Declare Int creditsLeft |y | | |Declare Real studentName ...

Words: 1394 - Pages: 6

Premium Essay

Resume

...Engineer | SOFTWARE PROFICIENCY |Web Technologies  |HTML, XML | |Script |PERL Scripting,Java Scripts | |RDBMS/DBMS |Oracle 9i | |IDE’s |Eclipse, NetBeans | |Languages |C++, SQL, PL\SQL, Visual Basic and JAVA | |Operating System |Windows XP, Windows 95/98, & UNIX | |PLM/PPM Packages |Windchill/Planisware 5 | PROJECTS UNDERTAKEN |Project Name |Support and Enhancement of the Product Planisware 5(PPM) | |Period |01-July-10 to | |Location...

Words: 431 - Pages: 2

Free Essay

Cis115

...Week 7 iLab—Sales Tax TCO 3: Given a simple problem, design and desk-check a solution algorithm requiring a modular design that is expressed in terms of pseudocode or program notes, input-process-output (IPO) analysis, and flow chart. * TCO 7: Given a program with logic errors that is intended as a solution to a simple problem, employ debugging diagnostics to remove and correct the errors. TCO 8: Given a more complex problem, develop a complete solution that includes a comprehensive statement of the problem, complete program design, and program documentation. Scenario Your algorithm will write two functions called ComputeTotal( ) and ComputeTax( ). ComputeTotal( ) will receive the quantity of items purchased, and the unit price of each item. It will return the total sales (quantity times price). ComputeTax( ) will receive total sales as a number and the state as a string and return the amount of tax depending on the state. NJ requires 7% tax, FL requires 6% tax, and NY has 4% tax. The main program will ask for the name of the customer and read the name in a variable called name. It will also ask for one of the three states listed above. It will ask for the number of items sold and the unit price of the item. Main will then call ComputeTotal( ), passing the quantity and unit price. Main will then call ComputeTax( ), passing the state and the amount of sales and receive back the tax. Finally Main( ) will print out the total sales, the tax amount, and the total...

Words: 784 - Pages: 4

Free Essay

Inventory System

...local Studies: 1. Facility Inventory System Introduction: Nowadays, companies becoming more competent as time pass. Anytime from now a new strategy, technology and discoveries may come up just for them to gain much profit. The problem that will be encountered is the maintenance for the system and the consistency of it to be used for a long time. We will be using a Structured system analysis and design for our methodology. We will also use Microsoft Visual Basic 6.0 as our programming language. 2. Online Sales and Inventory System of ACME Hardware Introduction: From the very earliest moments in the modern history of thecomputer, the people and the business world have witnessed theproliferation of computer system that obliges to meet the goal of Information technology. This problems are commonly encountered on the current Salesand Inventory System of Tacloban ACME Hardware? What must be proposed to make it happen? What are the input needed to develop this type of program. We will be using Microsoft Visual Basic 6.0 develop our program and we will be using Structured System Analysis And Design for our Methodology. 3. COMPUTERIZED MANAGEMENT AND MONITORING SYSTEM FOR MONTEJO NEWSPAPER SUPPLY AND MAGAZINE DISTRIBUTOR Introduction: The used of manual processes in business has decline since the rise of computerized and automated systems. And in fact, nowadays, the use of computer-based business system has become prevalent all throughout the......

Words: 282 - Pages: 2