Welcome back to my blog arybyan

Visual Basic 6 - Fungsi Operator

Visual Basic 6 - Fungsi Operator 






Listing Code :

Private Sub cmddiv_Click()
txthasil = Val(txtnil1.Text) & Val(txtnil2.Text)
End Sub

Private Sub cmdtambah_Click()
txthasil = Val(txtnil1.Text) + Val(txtnil2.Text)
End Sub

Private Sub cmdkurang_Click()
txthasil = Val(txtnil1.Text) - Val(txtnil2.Text)
End Sub

Private Sub cmdkali_Click()
txthasil = Val(txtnil1.Text) * Val(txtnil2.Text)
End Sub

Private Sub cmdbagi_Click()
txthasil = Val(txtnil1.Text) / Val(txtnil2.Text)
End Sub

Private Sub cmdmod_Click()
txthasil = Val(txtnil1.Text) Mod Val(txtnil2.Text)
End Sub

Private Sub cmd1_Click()
txthasil = Val(txtnil1.Text) = Val(txtnil2.Text)
End Sub

Private Sub cmd2_Click()
txthasil = Val(txtnil1.Text) < Val(txtnil2.Text)
End Sub

Private Sub cmd3_Click()
txthasil = Val(txtnil1.Text) > Val(txtnil2.Text)
End Sub

Private Sub cmd4_Click()
txthasil = Val(txtnil1.Text) <= Val(txtnil2.Text)
End Sub

Private Sub cmd5_Click()
txthasil = Val(txtnil1.Text) >= Val(txtnil2.Text)
End Sub

Private Sub cmd6_Click()
txthasil = Val(txtnil1.Text) <> Val(txtnil2.Text)
End Sub

Private Sub cmdkeluar_Click()
Dim a As String
a = MsgBox("Yakin arep minggat ??? ", vbQuestion + vbOKCancel, "Piye Son ?")
If a = vbOK Then
End
End If
End Sub

Private Sub cmdand_Click()
If txtnil1 = "true" And txtnil2 = "true" Then
txthasil = "true"
ElseIf txtnil1 = "true" And txtnil2 = "false" Then
txthasil = "false"
ElseIf txtnil1 = "true" And txtnil2 = "false" Then
txthasil = "false"
ElseIf txtnil1 = "false" And txtnil2 = "true" Then
txthasil = "false"
Else
txthasil = "false"
End If
End Sub

Private Sub cmdor_Click()
If txtnil1 = "true" Or txtnil2 = "true" Then
txthasil = "true"
ElseIf txtnil1 = "true" Or txtnil2 = "false" Then
txthasil = "true"
ElseIf txtnil1 = "false" Or txtnil2 = "true" Then
txthasil = "true"
Else
txthasil = "false"
End If
End Sub

Private Sub cmdNot_Click()
If cmbnot = True Then
txtnot = Not True
Else
txtnot = Not False
End If
End Sub

Private Sub cmdlagi_Click()
txtnil1.Text = ""
txtnil2.Text = ""
txthasil = ""
txtnot = ""
txtnil1.SetFocus
End Sub


إرسال تعليق