Calculator

VB calculator

Page 1 of 1

3 Replies - 3355 Views - Last Post: 28 January 2009 - 07:24 AM Rate Topic: -----

#1 jmclaret2000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 21-January 09

Calculator

Post icon  Posted 26 January 2009 - 05:51 PM

Hey guys can someone help me in making a VB calculator that computes the value of two intgers of the basic operations... (+ - * /)

Here's My code im confused on where to place the calculations...

Private Sub Command1_Click()
Text1.Text = " "
End Sub

Private Sub Command10_Click()
Text1.Text = 1
End Sub

Private Sub Command11_Click()
Text1.Text = 2
End Sub

Private Sub Command12_Click()
Text1.Text = 3
End Sub

Private Sub Command13_Click()
Text1.Text = "-"
End Sub

Private Sub Command14_Click()
Text1.Text = 0
End Sub

Private Sub Command17_Click()
Text1.Text = "/"
End Sub

Private Sub Command2_Click()
Text1.Text = 7
End Sub

Private Sub Command3_Click()
Text1.Text = 8
End Sub

Private Sub Command4_Click()
Text1.Text = 9
End Sub

Private Sub Command5_Click()
Text1.Text = "+"
End Sub

Private Sub Command6_Click()
Text1.Text = 4
End Sub

Private Sub Command7_Click()
Text1.Text = 5
End Sub

Private Sub Command8_Click()
Text1.Text = 6
End Sub

Private Sub Command9_Click()
Text1.Text = "*"
End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: Calculator

#2 Auzzie  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 43
  • View blog
  • Posts: 573
  • Joined: 20-January 09

Re: Calculator

Posted 26 January 2009 - 06:11 PM

Well what you need to do is create a Sub routine to take the clicked numbers and then perform the operation on them. Also to output it. Have a look at this link for ideas http://www.scribd.co...in-Visual-Basic
Was This Post Helpful? 0
  • +
  • -

#3 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: Calculator

Posted 26 January 2009 - 06:14 PM

What is the problem? First of all, you are just setting the Text property of the TextBox to a number instead of adding the number to the existing string (I assume that you are trying to do something similar to the Windows Calculator).

The basic math operations are executed as follows:

Addition

Variable = Variable + Variable



Subtraction

Variable = Variable - Variable



Division

Variable = Variable / Variable



Multiplication

Variable = Variable * Variable



There is also a tutorial on how to create a calculator:
http://www.dreaminco...wtopic50628.htm

This post has been edited by Core: 26 January 2009 - 06:18 PM

Was This Post Helpful? 0
  • +
  • -

#4 jmclaret2000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 21-January 09

Re: Calculator

Posted 28 January 2009 - 07:24 AM

Thanks for your links guys it really helped me a lot... :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1