Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?

View \Form1.frm

Calculator

Submitted By: muhammadsumair
Rating: starstarstarstarstar (Rate It)


VERSION 5.00
Begin VB.Form Form1
   BackColor       =   &H00808080&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Calculator"
   ClientHeight    =   4530
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3285
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "Form1.frx":0000
   ScaleHeight     =   4530
   ScaleWidth      =   3285
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command16
      Caption         =   "0"
      Height          =   495
      Left            =   120
      TabIndex        =   16
      Top             =   3840
      Width           =   495
   End
   Begin VB.CommandButton Command15
      Caption         =   "."
      Height          =   495
      Left            =   960
      TabIndex        =   15
      Top             =   3840
      Width           =   495
   End
   Begin VB.CommandButton Command14
      Caption         =   "="
      Height          =   495
      Left            =   1800
      TabIndex        =   14
      Top             =   3840
      Width           =   495
   End
   Begin VB.CommandButton Command13
      Caption         =   "/"
      Height          =   495
      Left            =   2640
      TabIndex        =   13
      Top             =   3840
      Width           =   495
   End
   Begin VB.CommandButton Command12
      Caption         =   "*"
      Height          =   495
      Left            =   2640
      TabIndex        =   12
      Top             =   3000
      Width           =   495
   End
   Begin VB.CommandButton Command11
      Caption         =   "---"
      Height          =   495
      Left            =   2640
      TabIndex        =   11
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton Command10
      Caption         =   "+"
      Height          =   495
      Left            =   2640
      TabIndex        =   10
      Top             =   1320
      Width           =   495
   End
   Begin VB.CommandButton Command9
      Caption         =   "9"
      Height          =   495
      Left            =   1800
      TabIndex        =   9
      Top             =   3000
      Width           =   495
   End
   Begin VB.CommandButton Command8
      Caption         =   "8"
      Height          =   495
      Left            =   960
      TabIndex        =   8
      Top             =   3000
      Width           =   495
   End
   Begin VB.CommandButton Command7
      Caption         =   "7"
      Height          =   495
      Left            =   120
      TabIndex        =   7
      Top             =   3000
      Width           =   495
   End
   Begin VB.CommandButton Command6
      Caption         =   "6"
      Height          =   495
      Left            =   1800
      TabIndex        =   6
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton Command5
      Caption         =   "5"
      Height          =   495
      Left            =   960
      TabIndex        =   5
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton Command4
      Caption         =   "4"
      Height          =   495
      Left            =   120
      TabIndex        =   4
      Top             =   2160
      Width           =   495
   End
   Begin VB.CommandButton Command3
      Caption         =   "3"
      Height          =   495
      Left            =   1800
      TabIndex        =   3
      Top             =   1320
      Width           =   495
   End
   Begin VB.CommandButton Command2
      Caption         =   "2"
      Height          =   495
      Left            =   960
      TabIndex        =   2
      Top             =   1320
      Width           =   495
   End
   Begin VB.CommandButton Command1
      Caption         =   "1"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   1320
      Width           =   495
   End
   Begin VB.TextBox Text1
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   720
      Width           =   3015
   End
   Begin VB.Label Label2
      BackColor       =   &H00FFFFFF&
      Height          =   375
      Left            =   120
      TabIndex        =   18
      Top             =   120
      Width           =   3015
   End
   Begin VB.Label Label1
      BackColor       =   &H00808080&
      Height          =   375
      Left            =   0
      TabIndex        =   17
      Top             =   0
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim e1 As Double
Dim r1 As Double
Dim t1 As String
Dim t2 As String
Dim s As Double
Dim p As Boolean
Dim su As Boolean
Dim m As Boolean
Dim q As Integer
Dim mu As Double
Dim di As Double
Dim d As Boolean

Private Sub Command1_Click()

Text1 = Text1 + "1"

End Sub

Private Sub Command10_Click()
p = False
If p = False Then q = 1
r1 = Text1
t1 = Text1
Text1 = " "
End Sub

Private Sub Command11_Click()
su = False
If su = False Then q = 2
s = Text1
t1 = Text1
Text1 = " "
End Sub

Private Sub Command12_Click()
m = False
If m = False Then q = 3
mu = Text1
t1 = Text1
Text1 = " "
End Sub

Private Sub Command13_Click()
d = False
If d = False Then q = 4
di = Text1
t1 = Text1
Text1 = " "
End Sub

Private Sub Command14_Click()
If q = 1 Then e1 = Text1
If q = 1 Then t2 = Text1
If q = 1 Then Text1 = " "
If q = 1 Then Text1 = r1 + e1
If q = 1 Then Label2.Caption = t1 + " +" + t2 + " ="
If q = 2 Then e1 = Text1
If q = 2 Then t2 = Text1
If q = 2 Then Text1 = " "
If q = 2 Then Text1 = s - e1
If q = 2 Then Label2.Caption = t1 + " -" + t2 + " ="
If q = 3 Then e1 = Text1
If q = 3 Then t2 = Text1
If q = 3 Then Text1 = " "
If q = 3 Then Text1 = mu * e1
If q = 3 Then Label2.Caption = t1 + " *" + t2 + " ="
If q = 4 Then e1 = Text1
If q = 4 Then t2 = Text1
If q = 4 Then Text1 = " "
If q = 4 Then Text1 = di / e1
If q = 4 Then Label2.Caption = t1 + " /" + t2 + " ="

End Sub

Private Sub Command15_Click()
Text1 = Text1 + "."

End Sub

Private Sub Command16_Click()
Text1 = Text1 + "0"

End Sub

Private Sub Command17_Click()
Text1 = " "
End Sub

Private Sub Command18_Click()

End Sub

Private Sub Command2_Click()
Text1 = Text1 + "2"

End Sub

Private Sub Command3_Click()
Text1 = Text1 + "3"

End Sub

Private Sub Command4_Click()
Text1 = Text1 + "4"

End Sub

Private Sub Command5_Click()
Text1 = Text1 + "5"

End Sub

Private Sub Command6_Click()
Text1 = Text1 + "6"

End Sub

Private Sub Command7_Click()
Text1 = Text1 + "7"

End Sub

Private Sub Command8_Click()
Text1 = Text1 + "8"

End Sub

Private Sub Command9_Click()
Text1 = Text1 + "9"

End Sub
 
corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.