Biasa tugas dari kampus suruh bikin Program Zodiak pake VB 6.0. Maklum saya sendiri pun baru mengenal bahasa program VB itu sendiri, jadi masih tanya - tanya embah google. hehehe.... Setelah puyeng dengan otak atik coding, akhirnya running juga hahaha Alhamdulillah. Baru deh saya desain sedemikian rupa hingga seperti tampilan gambar di atas.
Ini gan codingnya . hehe " Private Sub bln_Click() thn.SetFocus End Sub
Private Sub bln_KeyPress(KeyAscii As Integer) If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0 End Sub
Private Sub Command1_Click() If Text1 = "" Then s = MsgBox("Nama Anda Belum Di Isi !!", vbQuestion, "Peringatan") If s = vbOK Then Text1.SetFocus Exit Sub End If End If If tgl = "" Then s = MsgBox("Tanggal Lahir Anda Belum Di Isi !!", vbQuestion, "Peringatan") If s = vbOK Then tgl.SetFocus Exit Sub End If End If If bln = "" Then s = MsgBox("Bulan Lahir Anda Belum Di Isi !!", vbQuestion, "Peringatan") If s = vbOK Then bln.SetFocus Exit Sub End If End If If thn = "" Then s = MsgBox("Tahun Lahir Anda Belum Di Isi !!", vbQuestion, "Peringatan") If s = vbOK Then thn.SetFocus Exit Sub End If End If If (tgl.Text >= 21 And bln.Text = "Maret") Or (tgl.Text <= 20 And bln = "April") Then hasil.Text = "Aries" ElseIf (tgl.Text >= 21 And bln.Text = "April") Or (tgl.Text <= 21 And bln = "Mei") Then hasil.Text = "Taurus" ElseIf (tgl.Text >= 22 And bln.Text = "Mei") Or (tgl.Text <= 21 And bln = "Juni") Then hasil.Text = "Gemini" ElseIf (tgl.Text >= 22 And bln.Text = "Juni") Or (tgl.Text <= 22 And bln = "Juli") Then hasil.Text = "Cancer" ElseIf (tgl.Text >= 23 And bln.Text = "Juli") Or (tgl.Text <= 22 And bln = "Agustus") Then hasil.Text = "Leo" ElseIf (tgl.Text >= 23 And bln.Text = "Agustus") Or (tgl.Text <= 22 And bln = "September") Then hasil.Text = "Virgo" ElseIf (tgl.Text >= 23 And bln.Text = "September") Or (tgl.Text <= 22 And bln = "Oktober") Then hasil.Text = "Libra" ElseIf (tgl.Text >= 23 And bln.Text = "Oktober") Or (tgl.Text <= 21 And bln = "Nopember") Then hasil.Text = "Scorpio" ElseIf (tgl.Text >= 22 And bln.Text = "Nopember") Or (tgl.Text <= 21 And bln = "Desember") Then hasil.Text = "Desember" ElseIf (tgl.Text >= 22 And bln.Text = "Desember") Or (tgl.Text <= 20 And bln = "Januari") Then hasil.Text = "Capricorn" ElseIf (tgl.Text >= 21 And bln.Text = "Januari") Or (tgl.Text <= 19 And bln = "Februari") Then hasil.Text = "Aquarius" ElseIf (tgl.Text >= 20 And bln.Text = "Februari") Or (tgl.Text <= 20 And bln = "Maret") Then hasil.Text = "Pisces" End If End Sub
Private Sub Command2_Click() Text1.Text = "" tgl.Text = "" bln.Text = "" thn.Text = "" hasil.Text = "" Text1.SetFocus End Sub
Private Sub Form_Load() For i = 1 To 31 Latihan6.tgl.AddItem (Str(i)) Next i For i = 1 To 12 Latihan6.bln.AddItem (MonthName(i)) Next i For i = 1990 To Year(Now) Latihan6.thn.AddItem (Str(i)) Next Command2.BackColor = vbGrayText
Command3.BackColor = vbRed End Sub
Private Sub tgl_Click() bln.SetFocus End Sub
Private Sub tgl_KeyPress(KeyAscii As Integer) If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0 End Sub
Private Sub thn_Click() Command1.SetFocus End Sub
Private Sub thn_KeyPress(KeyAscii As Integer) If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0 End Sub "
bagi2 coding'a gan..
ReplyDeleteotak keram nich,ngak bres2,,,,
Ini gan codingnya . hehe
ReplyDelete" Private Sub bln_Click()
thn.SetFocus
End Sub
Private Sub bln_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
End Sub
Private Sub Command1_Click()
If Text1 = "" Then
s = MsgBox("Nama Anda Belum Di Isi !!", vbQuestion, "Peringatan")
If s = vbOK Then
Text1.SetFocus
Exit Sub
End If
End If
If tgl = "" Then
s = MsgBox("Tanggal Lahir Anda Belum Di Isi !!", vbQuestion, "Peringatan")
If s = vbOK Then
tgl.SetFocus
Exit Sub
End If
End If
If bln = "" Then
s = MsgBox("Bulan Lahir Anda Belum Di Isi !!", vbQuestion, "Peringatan")
If s = vbOK Then
bln.SetFocus
Exit Sub
End If
End If
If thn = "" Then
s = MsgBox("Tahun Lahir Anda Belum Di Isi !!", vbQuestion, "Peringatan")
If s = vbOK Then
thn.SetFocus
Exit Sub
End If
End If
If (tgl.Text >= 21 And bln.Text = "Maret") Or (tgl.Text <= 20 And bln = "April") Then
hasil.Text = "Aries"
ElseIf (tgl.Text >= 21 And bln.Text = "April") Or (tgl.Text <= 21 And bln = "Mei") Then
hasil.Text = "Taurus"
ElseIf (tgl.Text >= 22 And bln.Text = "Mei") Or (tgl.Text <= 21 And bln = "Juni") Then
hasil.Text = "Gemini"
ElseIf (tgl.Text >= 22 And bln.Text = "Juni") Or (tgl.Text <= 22 And bln = "Juli") Then
hasil.Text = "Cancer"
ElseIf (tgl.Text >= 23 And bln.Text = "Juli") Or (tgl.Text <= 22 And bln = "Agustus") Then
hasil.Text = "Leo"
ElseIf (tgl.Text >= 23 And bln.Text = "Agustus") Or (tgl.Text <= 22 And bln = "September") Then
hasil.Text = "Virgo"
ElseIf (tgl.Text >= 23 And bln.Text = "September") Or (tgl.Text <= 22 And bln = "Oktober") Then
hasil.Text = "Libra"
ElseIf (tgl.Text >= 23 And bln.Text = "Oktober") Or (tgl.Text <= 21 And bln = "Nopember") Then
hasil.Text = "Scorpio"
ElseIf (tgl.Text >= 22 And bln.Text = "Nopember") Or (tgl.Text <= 21 And bln = "Desember") Then
hasil.Text = "Desember"
ElseIf (tgl.Text >= 22 And bln.Text = "Desember") Or (tgl.Text <= 20 And bln = "Januari") Then
hasil.Text = "Capricorn"
ElseIf (tgl.Text >= 21 And bln.Text = "Januari") Or (tgl.Text <= 19 And bln = "Februari") Then
hasil.Text = "Aquarius"
ElseIf (tgl.Text >= 20 And bln.Text = "Februari") Or (tgl.Text <= 20 And bln = "Maret") Then
hasil.Text = "Pisces"
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
tgl.Text = ""
bln.Text = ""
thn.Text = ""
hasil.Text = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
For i = 1 To 31
Latihan6.tgl.AddItem (Str(i))
Next i
For i = 1 To 12
Latihan6.bln.AddItem (MonthName(i))
Next i
For i = 1990 To Year(Now)
Latihan6.thn.AddItem (Str(i))
Next
Command2.BackColor = vbGrayText
Command3.BackColor = vbRed
End Sub
Private Sub tgl_Click()
bln.SetFocus
End Sub
Private Sub tgl_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
End Sub
Private Sub thn_Click()
Command1.SetFocus
End Sub
Private Sub thn_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 8 Then KeyAscii = 0
End Sub "
cacad
ReplyDeletegan coding untuk shio ada ?
ReplyDeleteItu diatas lengkap gan, tinggal diubah aja nama zodiak-zodiak, sama tahunnya.
ReplyDeletegan itu ngoding di zodiak kan? punya saya kok eror ya 😂
ReplyDeletegan itu ngoding di cmdzodiak kan? ko punya saya gabisa ya compile eror pas ngoding
ReplyDeleteBos Kenap ya zodiaknya gak muncul
ReplyDelete