Buka program VB, kemudian buat project dengan tampilan dan properties seperti gambar.
Private Sub cmdplus_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub cmdminus_Click()
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub
Private Sub cmdmulti_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
Private Sub cmddiv_Click()
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub
Private Sub cmdmod_Click()
Text3.Text = Val(Text1.Text) Mod Val(Text2.Text)
End Sub
Private Sub cmdequal_Click()
Text4.Text = Val(Text1.Text) = Val(Text2.Text)
End Sub
Private Sub cmdmore_Click()
Text4.Text = Val(Text1.Text) > Val(Text2.Text)
End Sub
Private Sub cmdless_Click()
Text4.Text = Val(Text1.Text) < Val(Text2.Text)
End Sub
Private Sub cmdmore_equal_Click()
Text4.Text = Val(Text1.Text) >= Val(Text2.Text)
End Sub
Private Sub cmdless_equal_Click()
Text4.Text = Val(Text1.Text) <= Val(Text2.Text)
End Sub
Private Sub cmdnot_equal_Click()
Text4.Text = Val(Text1.Text) <> Val(Text2.Text)
End Sub
Private Sub cmdclear_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdand_Click()
If Text1.Text = "true" And Text2.Text = "true" Then
Text4 = "True"
ElseIf Text1.Text = "true" And Text2.Text = "false" Then
Text4 = "False"
ElseIf Text1.Text = "false" And Text2.Text = "true" Then
Text4 = "False"
Else
Text4 = "False"
End If
End Sub
Private Sub cmdor_Click()
If Text1.Text = "true" Or Text2.Text = "true" Then
Text4 = "True"
ElseIf Text1.Text = "true" Or Text2.Text = "false" Then
Text4 = "True"
ElseIf Text1.Text = "false" Or Text2.Text = "true" Then
Text4 = "True"
Else
Text4 = "False"
End If
End Sub
|
Tampilan program setelah memasukkan angka 100 di kedua sisi, dan mengklik tombol = (sama dengan) |
Tampilan program setelah mengetikkan kata "true" dan "false" dan menekan tombol And |
Program telah sukses dirancang!
Bila ada permasalahan, silahkan keluhannya di komentar!
Tidak ada komentar:
Posting Komentar