BP Forums
I need help making a calculator like a windows calculator - Printable Version

+- BP Forums (https://bpforums.info)
+-- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=55)
+--- Forum: Archived Forums (https://bpforums.info/forumdisplay.php?fid=56)
+---- Forum: VB.NET (Visual Basic 2010/2008) (https://bpforums.info/forumdisplay.php?fid=8)
+----- Forum: Programming Help (https://bpforums.info/forumdisplay.php?fid=9)
+----- Thread: I need help making a calculator like a windows calculator (/showthread.php?tid=582)



I need help making a calculator like a windows calculator - Xandereliteinsight - 07-23-2012

I want to create a calculator that has many functions but i cant figure out?


Re: I need help making a calculator like a windows calculato - brandonio21 - 07-23-2012

Well, making a basic calculator is pretty easy! You just need several buttons and a textbox! You also need variables to keep track of the currently typed number and the number to perform the operation on! I have never made a calculator, but I know some of our members have. Maybe they can chime in and give you some tips!


Re: I need help making a calculator like a windows calculato - brco900033 - 07-24-2012

Maybe these tutorials will help you.

To make the main calculator:
http://www.youtube.com/watch?v=FWzUbobxzlc&feature=related

To make a temperature converter:
http://www.youtube.com/watch?v=0QaSo5_vXXc

To make a time calculator:
http://answers.yahoo.com/question/index?qid=20100727054952AAGSG7c

Sorry, I didn't find more tutorials.


Re: I need help making a calculator like a windows calculato - Xandereliteinsight - 07-24-2012

thanks it helped heres my final result i will post the app in the other section

note: this is basic and does not have advanced buttons



Public Class Form1
Public value1 As Double
Public oper As Char

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
showvalue(Button1)
End Sub

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

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
showvalue(Button3)
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
showvalue(Button6)
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
showvalue(Button5)
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
showvalue(Button4)
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
showvalue(Button9)
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
showvalue(Button8)
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
showvalue(Button7)
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
showvalue(Button11)
End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
arithematic(Button16)
End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
arithematic(Button15)
End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
arithematic(Button14)
End Sub

Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
arithematic(Button13)
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
Calculate()
End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
TextBox1.Text = TextBox1.Text & "."
End Sub
End Class


Module Module1
Sub showvalue(ByVal butt As Button)
Form1.TextBox1.Text = Val(Form1.TextBox1.Text & butt.Text)
End Sub
Sub arithematic(ByVal butt As Button)
Form1.value1 = Val(Form1.TextBox1.Text)
Form1.oper = butt.Text
Form1.TextBox1.Text = ""
End Sub
Sub Calculate()
Select Case Form1.oper
Case "+"
Form1.TextBox1.Text = Form1.value1 + Val(Form1.TextBox1.Text)
Case "x"
Form1.TextBox1.Text = Form1.value1 * Val(Form1.TextBox1.Text)
Case "-"
Form1.TextBox1.Text = Form1.value1 - Val(Form1.TextBox1.Text)
Case "/"
Form1.TextBox1.Text = Form1.value1 / Val(Form1.TextBox1.Text)
End Select
End Sub
End Module


Re: I need help making a calculator like a windows calculato - Moldraxian - 07-24-2012

I made a calculator around a year ago, You can make them square root but you need to press alt+251 or something. You can find lots of operators by using the alt+### codes. Just note, it may not be alt but ctrl or something.