Tugas 2 Visual 1

Rancanglah form seperti gambar di bawah ini, kemudian simpan projek dengan nama tugas 2 dan formnya beri nama hari lahir.  Simpan projek dan form di folder Tugas 2

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()

    ‘MENCARI HARI LAHIR

    Dim KodeHari As Byte

    Dim Hari As String

    KodeHari = Weekday(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 = “Jumat”

        Case 7: Hari = “Sabtu”

    End Select

    Text2 = Hari

   

    ‘MENCARI BINTANG

    Dim Tg, Bl As Byte

    Dim Btg As String

    Tg = Day(Text1): Bl = Month(Text1)

    If (Tg >= 21 And Bl = 3) Or (Tg <= 20 And Bl = 4) Then Btg = “ARIES”

    If (Tg >= 21 And Bl = 4) Or (Tg <= 21 And Bl = 5) Then Btg = “TAURUS”

    If (Tg >= 22 And Bl = 5) Or (Tg <= 21 And Bl = 6) Then Btg = “GEMINI”

    If (Tg >= 22 And Bl = 6) Or (Tg <= 22 And Bl = 7) Then Btg = “CANCER”

    If (Tg >= 23 And Bl = 7) Or (Tg <= 22 And Bl = 8) Then Btg = “LEO”

    If (Tg >= 23 And Bl = 8) Or (Tg <= 22 And Bl = 9) Then Btg = “VIRGO”

    If (Tg >= 23 And Bl = 9) Or (Tg <= 22 And Bl = 10) Then Btg = “LIBRA”

    If (Tg >= 23 And Bl = 10) Or (Tg <= 21 And Bl = 11) Then Btg = “SCORPIO”

    If (Tg >= 22 And Bl = 11) Or (Tg <= 21 And Bl = 12) Then Btg = “SAGITARIUS”

    If (Tg >= 22 And Bl = 12) Or (Tg <= 20 And Bl = 1) Then Btg = “CAPRICORN”

    If (Tg >= 21 And Bl = 1) Or (Tg <= 19 And Bl = 2) Then Btg = “AQUARIUS”

    If (Tg >= 20 And Bl = 2) Or (Tg <= 20 And Bl = 3) Then Btg = “PISCES”

    Text3 = Btg

End Sub

Print Friendly, PDF & Email