well Rakesh, You need three variables, one for the first number of type double(to hold large numbers.) one for the second number, and of course one for the sign, or type of calculation we are doing.
Dim first As Double
Dim second As Double
Dim sign As String
Private Sub Command1_Click(Index As Integer)
If txtDisplay.Text = "" Then
txtDisplay.Text
= Command1(Index).Caption
Else
txtD isplay.Text
= txtDisplay.Text & Command1(Index).Caption
End If
End Sub
Private Sub Command2_Click(Index As Integer)
first = txtDisplay.Text
txtDisplay.Te xt = ""
sign = Command2(Index).Caption
End Sub
Private Sub Form_Load()
txtDisplay.Enable d = False
txtDisplay.MaxLength = 10
End Sub
Private Sub cmdEq_Click()
second = txtDisplay.Text
If sign = "-" Then
txtDisplay.Text
= first - second
ElseIf sign = "+" Then
txtDisplay.Text
= first + second
ElseIf sign = "*" Then
txtDisplay.Text
= first * second
ElseIf sign = "/" Then
txtDisplay.Text
= first / second
End If
End Sub
Private Sub cmdDot_Click()
If InStr(txtDisplay.Text, ".") = 0 Then
txtDisplay.Text = txtDisplay.Text & "."
End If
End Sub
Private Sub cmdClear_Click()
txtDisplay.T ext = "0"
End Sub
For more details , Please visit the site -
http://www.osix.net/modules /arti cle/?id=53
Answered by
Romi
, an ibibo Master,
at
5:16 PM on June 16, 2008