Hay programers VB. Masih penasaran dengan tutorial vb berikutnya?. Okay, Tutorial Vb kali ini saya akan membahas, bagaimana membuat program zodiac sederhana. Bagi kamu para remaja zaman sekarang yang suka sekali dengan ramalan-ramalan berupa astronomi, percintaan, karir, kehidupan dan masih banyak lagi. Akan tetapi saya hanya akan membahas yang zodiak.
Komponen Game VB Zodiac
Syarat komponen yang dibutuhkan:
- Label = 33
- Image = 19
- Vscrollbar = 1
- HScrollbar = 1
- CommandButton = 1
Syarat komponen tambahan
- Tidak ada
Cara Membuat Game VB Zodiac
Kenapa banyak sekali image yang digunakan dalam program ini? memang dasarnya program ini menggunakan gambar dalam berinteraksi terhadap penggunananya.
Berikut ini Listing Codenya:
Option Explicit
Private Type ZodiacRecord
SignDesc As String
House As String
Gemstone As String
NewAgeStone As String
Colors As String
OppositeSign As String
LeastCompat As String
RulingPlanet As String
Element As String
Anatomy As String
Flower As String
MostCompat As String
TarotCard As String
PositiveChars As String
NegativeChars As String
End Type
Private maudtZodiacRec(1 To 12) As ZodiacRecord
Private mintRowStart As Integer
Private mintColStart As Integer
'----------------------------------------------------------------------------
Private Sub Form_Load()
'----------------------------------------------------------------------------
MsgBox "Kunjungi saya di www.vb-6.com", vbInformation + vbOKOnly, " ^,..,^"
Dim intZFileNbr As Integer
Dim strFileName As String
Dim intSignX As Integer
intZFileNbr = FreeFile
strFileName = App.Path & IIf(Right$(App.Path, 1) = "\", "", "\") _
& "NewZodiac.txt"
Open strFileName For Input As #intZFileNbr
intSignX = 0
Do Until EOF(intZFileNbr)
intSignX = intSignX + 1
If intSignX > 12 Then
MsgBox "More than 12 zodiac records are present in the input file. " _
& "Please check the data and try again.", _
vbCritical, _
"Too Many Records"
End
End If
With maudtZodiacRec(intSignX)
Input #intZFileNbr, _
.SignDesc, _
.House, _
.Gemstone, _
.NewAgeStone, _
.Colors, _
.OppositeSign, _
.LeastCompat, _
.RulingPlanet, _
.Element, _
.Anatomy, _
.Flower, _
.MostCompat, _
.TarotCard, _
.PositiveChars, _
.NegativeChars
End With
Loop
Close #intZFileNbr
If intSignX < 12 Then MsgBox "Fewer than 12 zodiac records are present in the input file. " _ & "Please check the data and try again.", _ vbCritical, _ "Too Few Records" End End If mintRowStart = 1 mintColStart = 2 SetColumnHeaders DisplayZodiacData End Sub '---------------------------------------------------------------------------- Private Sub hsbZGrid_Change() '---------------------------------------------------------------------------- mintColStart = hsbZGrid.Value SetColumnHeaders DisplayZodiacData End Sub '---------------------------------------------------------------------------- Private Sub vsbZGrid_Change() '---------------------------------------------------------------------------- mintRowStart = vsbZGrid.Value DisplayZodiacData End Sub '---------------------------------------------------------------------------- Private Sub cmdExit_Click() '---------------------------------------------------------------------------- End End Sub '---------------------------------------------------------------------------- Private Sub SetColumnHeaders() '---------------------------------------------------------------------------- Select Case mintColStart Case 2 lblColHdr(1).Caption = "House" lblColHdr(2).Caption = "Gemstone" lblColHdr(3).Caption = "New Age Stone" Case 3 lblColHdr(1).Caption = "Gemstone" lblColHdr(2).Caption = "New Age Stone" lblColHdr(3).Caption = "Colors" Case 4 lblColHdr(1).Caption = "New Age Stone" lblColHdr(2).Caption = "Colors" lblColHdr(3).Caption = "Opposite Sign" Case 5 lblColHdr(1).Caption = "Colors" lblColHdr(2).Caption = "Opposite Sign" lblColHdr(3).Caption = "Least Compatible Signs" Case 6 lblColHdr(1).Caption = "Opposite Sign" lblColHdr(2).Caption = "Least Compatible Signs" lblColHdr(3).Caption = "Ruling Planet" Case 7 lblColHdr(1).Caption = "Least Compatible Signs" lblColHdr(2).Caption = "Ruling Planet" lblColHdr(3).Caption = "Element" Case 8 lblColHdr(1).Caption = "Ruling Planet" lblColHdr(2).Caption = "Element" lblColHdr(3).Caption = "Anatomy" Case 9 lblColHdr(1).Caption = "Element" lblColHdr(2).Caption = "Anatomy" lblColHdr(3).Caption = "Flower" Case 10 lblColHdr(1).Caption = "Anatomy" lblColHdr(2).Caption = "Flower" lblColHdr(3).Caption = "Most Compatible Signs" Case 11 lblColHdr(1).Caption = "Flower" lblColHdr(2).Caption = "Most Compatible Signs" lblColHdr(3).Caption = "Tarot Card" Case 12 lblColHdr(1).Caption = "Most Compatible Signs" lblColHdr(2).Caption = "Tarot Card" lblColHdr(3).Caption = "Positive Characteristics" Case 13 lblColHdr(1).Caption = "Tarot Card" lblColHdr(2).Caption = "Positive Characteristics" lblColHdr(3).Caption = "Negative Characteristics" End Select End Sub '---------------------------------------------------------------------------- Private Sub DisplayZodiacData() '---------------------------------------------------------------------------- Dim intX As Integer Dim intRecordIndex As Integer intRecordIndex = mintRowStart For intX = 0 To 6 With maudtZodiacRec(intRecordIndex) lblCell1(intX).Caption = .SignDesc imgSign(intX).Picture = imgSourceSign(intRecordIndex - 1).Picture Select Case mintColStart Case 2 lblCell2(intX).Caption = .House lblCell3(intX).Caption = .Gemstone lblCell4(intX).Caption = .NewAgeStone Case 3 lblCell2(intX).Caption = .Gemstone lblCell3(intX).Caption = .NewAgeStone lblCell4(intX).Caption = .Colors Case 4 lblCell2(intX).Caption = .NewAgeStone lblCell3(intX).Caption = .Colors lblCell4(intX).Caption = .OppositeSign Case 5 lblCell2(intX).Caption = .Colors lblCell3(intX).Caption = .OppositeSign lblCell4(intX).Caption = .LeastCompat Case 6 lblCell2(intX).Caption = .OppositeSign lblCell3(intX).Caption = .LeastCompat lblCell4(intX).Caption = .RulingPlanet Case 7 lblCell2(intX).Caption = .LeastCompat lblCell3(intX).Caption = .RulingPlanet lblCell4(intX).Caption = .Element Case 8 lblCell2(intX).Caption = .RulingPlanet lblCell3(intX).Caption = .Element lblCell4(intX).Caption = .Anatomy Case 9 lblCell2(intX).Caption = .Element lblCell3(intX).Caption = .Anatomy lblCell4(intX).Caption = .Flower Case 10 lblCell2(intX).Caption = .Anatomy lblCell3(intX).Caption = .Flower lblCell4(intX).Caption = .MostCompat Case 11 lblCell2(intX).Caption = .Flower lblCell3(intX).Caption = .MostCompat lblCell4(intX).Caption = .TarotCard Case 12 lblCell2(intX).Caption = .MostCompat lblCell3(intX).Caption = .TarotCard lblCell4(intX).Caption = .PositiveChars Case 13 lblCell2(intX).Caption = .TarotCard lblCell3(intX).Caption = .PositiveChars lblCell4(intX).Caption = .NegativeChars End Select End With intRecordIndex = intRecordIndex + 1 Next End Sub
Saya sudah menyediakan wadah buat kamu. Kamu bisa melakukan copas kode tersebut langsung dari web secara utuh tanpa terputus-putus seperti di atas & mendownload program itu secara utuh agar bisa digunakan di PC mode offline.
kamu bisa melihat kode dan mendapatkan sample membuat state dengan vb dengan mengklik Game VB ZODIAC
Kalau kalian suka dengan artikel ini, like dengan FB. Jika kalian masih kurang mengerti, silahkan bertanya dicomment postingan ini. Program ini dibuat dengan Visual Basic di www.vb-6.com
Program ini berasal dari www.thevbprogrammer.com