Dim firstoperand As String
Dim secondoperand As String
Dim myoperator As Integer
Dim firstorsecond As Boolean
Private Sub Cmd결과_Click()
If firstorsecond = True Then
Txt결과 = Str(Val(firstoperand) + Val(secondoperand))
Txt결과 = Str(Val(firstoperand) - Val(secondoperand))
Txt결과 = Str(Val(firstoperand) * Val(secondoperand))
If Val(secondoperand) = 0 Then
MsgBox "0으로 나눌수 없습니다", 48, "파일편집기"
Else: Txt결과 = Str(Val(firstoperand) * Val(secondoperand))
End If
End If
End Sub
Private Sub CmdCE_Click()
firstoperand = ""
secondoperand = ""
firstorsecond = False
myoperator = -1
Txt결과.Text = ""
End Sub
Private Sub Comnum_Click(Index As Integer)
If firstorsecond = True Then
secondoperand = secondoperand + Str(Index)
Else: firstoperand = firstoperand + Str(Index)
End If
Txt결과.Text = Txt결과.Text + Str(Index)
End Sub
Private Sub CmdOP_Click(Index As Integer)
firstoperand = text결과.Text
Txt결과.Text = ""
secondoperand = text결과.Text
selectcase myoperator
Case "CmdOP =0"
myoperator = firstoperand + secondoperand
Case "CmdOP =1"
myoperator = firstoperand - secondoperand
Case "CmdOP =2"
myoperator = firstoperand * secondoperand
Case "CmdOP =3"
myoperator = firstoperand / secondoperand
End Select
If firstorsecond = True Then
MsgBox "하나의 식만 계산할수 있습니다", 48, "파일편집기"
Else: Txt결과.Text = myoperator
End If
Txt결과.Text = ""
End Sub
Private Sub Form_Load()
firstorsecond = False
Txt결과.Text = ""
End Sub
첫댓글 뭐가 잘못됐는지 알수가 없어요 ㅠㅠ