Selamat Datang di blog Rahmani Azlan

Jumat, 22 April 2011

Contoh Program Zodiac Visual Basic

Program :

Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "Isi Nama Anda", vbInformation, "Waring"
Text1.SetFocus
Exit Sub
End If

TGl = Me.DTPicker1.Value
tglLhr = Day(TGl)
blnLhr = Month(TGl)

If (tglLhr >= 22 And blnLhr = 12) Or (tglLhr <= 20 And blnLhr = 1) Then
zodiak = "Capricorn"
ElseIf (tglLhr >= 21 And blnLhr = 1) Or (tglLhr <= 19 And blnLhr = 2) Then
zodiak = "Aquarius"
ElseIf (tglLhr >= 20 And blnLhr = 2) Or (tglLhr <= 20 And blnLhr = 3) Then
zodiak = "Pisces"
ElseIf (tglLhr >= 21 And blnLhr = 3) Or (tglLhr <= 19 And blnLhr = 4) Then
zodiak = "Aries"
ElseIf (tglLhr >= 20 And blnLhr = 4) Or (tglLhr <= 20 And blnLhr = 5) Then
zodiak = "Taurus"
ElseIf (tglLhr >= 21 And blnLhr = 5) Or (tglLhr <= 21 And blnLhr = 6) Then
zodiak = "Gemini"
ElseIf (tglLhr >= 22 And blnLhr = 6) Or (tglLhr <= 22 And blnLhr = 7) Then
zodiak = "Cancer"
ElseIf (tglLhr >= 23 And blnLhr = 7) Or (tglLhr <= 23 And blnLhr = 8) Then
zodiak = "Leo"
ElseIf (tglLhr >= 24 And blnLhr = 8) Or (tglLhr <= 22 And blnLhr = 9) Then
zodiak = "Virgo"
ElseIf (tglLhr >= 23 And blnLhr = 9) Or (tglLhr <= 23 And blnLhr = 10) Then
zodiak = "Libra"
ElseIf (tglLhr >= 24 And blnLhr = 10) Or (tglLhr <= 22 And blnLhr = 11) Then
zodiak = "Scorpio"
ElseIf (tglLhr >= 23 And blnLhr = 11) Or (tglLhr <= 21 And blnLhr = 12) Then
zodiak = "Sagitarius"
End If


If Option1 = True Then
Label4.Caption = "Mr. " + Text1.Text
ElseIf Option1 = False Then
Label4.Caption = "Ms. " + Text1.Text
Else
MsgBox "Pilih Dulu Jenis Kelamin", vbInformation, "Warning"
End If

Me.Label6 = "Zodiak Anda " + zodiak
Me.Label5 = TGl
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Label4 = ""
Label5 = ""
Label6 = ""
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Output :

Tidak ada komentar:

Posting Komentar