Home » » Hari lahir & bintang visual basic

Hari lahir & bintang visual basic

Berikut ini adalah salah satu program untuk menentukan hari lahir dan bintang menggunakan visual basic.

Option Explicit
Dim KodeHari As Byte
Dim Hari As String
Dim Tg, Bl As Byte
Dim Btg As String

Private Sub Form_Load()
    Command1.Enabled = False
End Sub

Private Sub Text1_Change()
    If IsDate(Text1) Then
        Command1.Enabled = True
    Else
        Command1.Enabled = False
    End If
End Sub

Private Sub Command1_Click()
    KodeHari = Weekday(Text1)
    Tg = Day(Text1)
    Bl = Month(Text1)
    Select Case KodeHari
    Case 1
        Hari = "Minggu"
    Case 2
        Hari = "Senin"
    Case 3
        Hari = "Selasa"
    Case 4
        Hari = "Rabu"
    Case 5
        Hari = "Kamis"
    Case 6
        Hari = "Jum'at"
    Case 7
        Hari = "Sabtu"
    End Select
    If (Tg >= 21 And Bl = 3) Or (Tg <= 20 And Bl = 4) Then
        Btg = "ARIES"
    ElseIf (Tg >= 21 And Bl = 4) Or (Tg <= 21 And Bl = 5) Then
        Btg = "TAURUS"
    ElseIf (Tg >= 22 And Bl = 5) Or (Tg <= 21 And Bl = 6) Then
        Btg = "GEMINI"
    ElseIf (Tg >= 22 And Bl = 6) Or (Tg <= 22 And Bl = 7) Then
        Btg = "CANCER"
    ElseIf (Tg >= 23 And Bl = 7) Or (Tg <= 22 And Bl = 8) Then
        Btg = "LEO"
    ElseIf (Tg >= 23 And Bl = 8) Or (Tg <= 22 And Bl = 9) Then
        Btg = "VIRGO"
    ElseIf (Tg >= 23 And Bl = 9) Or (Tg <= 22 And Bl = 10) Then
        Btg = "LIBRA"
    ElseIf (Tg >= 23 And Bl = 10) Or (Tg <= 21 And Bl = 11) Then
        Btg = "SCORPIO"
    ElseIf (Tg >= 22 And Bl = 11) Or (Tg <= 21 And Bl = 12) Then
        Btg = "SAGITARIUS"
    ElseIf (Tg >= 22 And Bl = 12) Or (Tg <= 20 And Bl = 1) Then
        Btg = "CAPRICORN"
    ElseIf (Tg >= 21 And Bl = 1) Or (Tg <= 19 And Bl = 2) Then
        Btg = "AQUARIUS"
    ElseIf (Tg >= 20 And Bl = 2) Or (Tg <= 20 And Bl = 3) Then
        Btg = "PISCES"
    End If
    Text2 = Hari
    Text3 = Btg
End Sub

0 komentar:

Posting Komentar