Using Visual Basic 2005, Just Learning

I have found my way to Visual Basic 2005 Express Edition, I have tried online tutorials and for some odd reason a thousand errors came up. I am working on a basic calculator right now and then I am gonna throw in some Area formulas and a Pi key, 3.141592653589. Can some one help me out? I need to get the basic calculator up and running, maybe some info on how to throw in the extras.

Warning: I have no exp.

THANKS
 
Dim var_First_Number As Double
Dim var_Second_Number As Double
Dim var_Operator As String

Private Sub cmd_Clear_Click()
txt_Display = ""
End Sub

Private Sub cmd_Divide_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Div"
txt_Display = ""
End If
End Sub

Private Sub cmd_Eight_Click()
txt_Display = txt_Display & 8
End Sub

Private Sub cmd_Equals_Click()
var_Second_Number = txt_Display
If var_Operator = "Add" Then
txt_Display = var_First_Number + var_Second_Number
ElseIf var_Operator = "Min" Then
txt_Display = var_First_Number - var_Second_Number
ElseIf var_Operator = "Div" Then
txt_Display = var_First_Number / var_Second_Number
ElseIf var_Operator = "Mul" Then
txt_Display = var_First_Number * var_Second_Number
End If
End Sub

Private Sub cmd_Five_Click()
txt_Display = txt_Display & 5
End Sub

Private Sub cmd_Four_Click()
txt_Display = txt_Display & 4
End Sub

Private Sub cmd_Nine_Click()
txt_Display = txt_Display & 9
End Sub

Private Sub cmd_Plus_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Add"
txt_Display = ""
End If
End Sub

Private Sub cmd_Seven_Click()
txt_Display = txt_Display & 7
End Sub

Private Sub cmd_Six_Click()
txt_Display = txt_Display & 6
End Sub

Private Sub cmd_Subtract_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Min"
txt_Display = ""
End If
End Sub

Private Sub cmd_Three_Click()
txt_Display = txt_Display & 3
End Sub

Private Sub cmd_Times_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Mul"
txt_Display = ""
End If
End Sub

Private Sub cmd_Two_Click()
txt_Display = txt_Display & 2
End Sub

Private Sub cmd_Zero_Click()
txt_Display = txt_Display & 0
End Sub

Private Sub cmd_One_Click()
txt_Display = txt_Display & 1
End Sub


There's the code for a calculator, I made one in college, Obviously you'll have to rename everything so that it matches the code, or you could change the code to match your buttons, either would work.

Here's the thread with it it, You can download it to see how it looks and works.
http://www.computerforum.com/80143-kornowskis-software.html
 
I was wanting to develop one that would give me a hand in Calculus 2, something like a TI-83 interface. I just want to screw around and learn to create a few programs.
 
Back
Top