Dim op As String
Dim num1 As Double
Dim num2 As Double
// 숫자 버튼
Private Sub Command1_Click()
text1.Text = text1.Text & 1
End sub
Private Sub Command2_Click()
text1.Text = text1.Text & 2
End sub
Private Sub Command3_Click()
text1.Text = text1.Text & 3
End sub
Private Sub Command4_Click()
text1.Text = text1.Text & 4
End sub
Private Sub Command5_Click()
text1.Text = text1.Text & 5
End sub
... 0까지
// 소수점
Private Sub Command11_Click()
text1.Text = text1.Text & "."
End sub
// 초기화
Private Sub Command12_Click()
text1.Text = "0"
End sub
// 더하기
Private Sub Command13_Click()
num1 = Text1.Text
text1.Text = ""
op = "+"
End sub
Private Sub Command14_Click()
num1 = Text1.Text
text1.Text = ""
op = "-"
End sub
Private Sub Command15_Click()
num1 = Text1.Text
text1.Text = ""
op = "*"
End sub
Private Sub Command16_Click()
num1 = Text1.Text
text1.Text = ""
op = "/"
End sub
// = 계산값 출력
Private Sub Command14_Click()
num2 = Text1.Text
if op = "+" then
text1.Text = num1 + num2
elseif op = "-" then
text1.Text = num1 - num2
elseif op = "*" then
text1.Text = num1 * num2
elseif op = "/" then
text1.Text = num1 / num2
End If
End sub
댓글