ลำดับตอนที่ #2
คืนค่าการตั้งค่าทั้งหมด
คุณแน่ใจว่าต้องการคืนค่าการตั้งค่าทั้งหมด ?
ลำดับตอนที่ #2 : [VB] Calculater เครื่องคิดเลข + FILE
​โ้ำ​นว
Dim num1 As IntegerDim num2 As IntegerDim result As IntegerDim sign As String
​โ้ำ​นว
​โ้ปุ่มัว​เล 0-9
Private Sub Button10_Click()
If Text1.Text <> "0" Then
Text1.Text = Text1.Text + "0"
Else
Text1.Text = "0"
End If
End Sub
Private Sub Button1_Click()
If Text1.Text <> "1" Then
Text1.Text = Text1.Text + "1"
Else
Text1.Text = "1"
End If
End Sub
Private Sub Button2_Click()
If Text1.Text <> "2" Then
Text1.Text = Text1.Text + "2"
Else
Text1.Text = "2"
End If
End Sub
Private Sub Button3_Click()
If Text1.Text <> "3" Then
Text1.Text = Text1.Text + "3"
Else
Text1.Text = "3"
End If
End Sub
Private Sub Button4_Click()
If Text1.Text <> "4" Then
Text1.Text = Text1.Text + "4"
Else
Text1.Text = "4"
End If
End Sub
Private Sub Button5_Click()
If Text1.Text <> "5" Then
Text1.Text = Text1.Text + "5"
Else
Text1.Text = "5"
End If
End Sub
Private Sub Button6_Click()
If Text1.Text <> "6" Then
Text1.Text = Text1.Text + "6"
Else
Text1.Text = "6"
End If
End Sub
Private Sub Button7_Click()
If Text1.Text <> "7" Then
Text1.Text = Text1.Text + "7"
Else
Text1.Text = "7"
End If
End Sub
Private Sub Button8_Click()
If Text1.Text <> "8" Then
Text1.Text = Text1.Text + "8"
Else
Text1.Text = "8"
End If
End Sub
Private Sub Button9_Click()
If Text1.Text <> "9" Then
Text1.Text = Text1.Text + "9"
Else
Text1.Text = "9"
End If
End Sub
​โ้ปุ่มัว​เล 0-9
​โ้ปุ่ม +,-,*,/
Private Sub cmdplus_Click()
num1 = Val(Text1.Text)
Text1.Text = ""
sign = "+" 'cmdplus = + '
End Sub
Private Sub cmdminus_Click()
num1 = Val(Text1.Text)
Text1.Text = ""
sign = "-" 'cmdminus = - '
End Sub
Private Sub cmdmultiply_Click()
num1 = Val(Text1.Text)
Text1.Text = ""
sign = "*" 'cmdmultiply = * '
End Sub
Private Sub cmddivide_Click()
num1 = Val(Text1.Text)
Text1.Text = ""
sign = "/" 'cmddivide = / '
End Sub
​โ้ปุ่ม +,-,*,/
​โ้ปุ่ม =
Private Sub cmdequals_Click()
num2 = Val(Text1.Text)
If sign = "+" Then result = num1 + num2
If sign = "-" Then result = num1 - num2
If sign = "*" Then result = num1 * num2
If sign = "/" Then result = num1 / num2
Text1.Text = Str(result)
End Sub
​โ้ปุ่ม =
​โ้ปุ่ม CE
Private Sub cmdce_Click()
Text1.Text = " "
End Sub
​โ้ปุ่ม CE
เก็บเข้าคอลเล็กชัน
ความคิดเห็น