Hi..We do have a project in school using visual basi 6.0 named "Memory Game". I have started to do it however i cant finish it. I have attached the interface of the program.


Click image to match in pairs
Card will randomize each test
Each match will give 10 points
*image as background

Rules:
Click image to match in pairs
Card will randomize each test
Each match will give 10 points

*image as background
* 6 pairs of image

Common Toolbox will be used

12 image or picture box
1 command button for start
1 label "Press Start to View Cards for 10 seconds"
1 timer
1 label for points

NOTE: This is a basic memory game. Use only basic statements/commands like array, if else statement , Loopings etc.

Option Explicit
Dim a(11) As String
Dim i As Integer
Dim r As Double

Private Sub Command1_Click()
Timer1.Enabled = True
Timer1.Interval = 1000
Picture1.Picture = LoadPicture(a(1))
Picture2.Picture = LoadPicture(a(2))
Picture3.Picture = LoadPicture(a(3))
Picture4.Picture = LoadPicture(a(4))
Picture5.Picture = LoadPicture(a(5))
Picture6.Picture = LoadPicture(a(6))
Picture7.Picture = LoadPicture(a(7))
Picture8.Picture = LoadPicture(a(8))
Picture9.Picture = LoadPicture(a(9))
Picture10.Picture = LoadPicture(a(10))
Picture11.Picture = LoadPicture(a(11))
Picture12.Picture = LoadPicture(a(0))
End Sub

Private Sub Form_Load()
a(0) = "Chrysanthemum.jpg"
a(1) = "Desert.jpg"
a(2) = "Hydrangeas.jpg"
a(3) = "Jellyfish.jpg"
a(4) = "Koala.jpg"
a(5) = "Lighthouse.jpg"
a(6) = "Chrysanthemum.jpg"
a(7) = "Desert.jpg"
a(8) = "Hydrangeas.jpg"
a(9) = "Jellyfish.jpg"
a(10) = "Koala.jpg"
a(11) = "Lighthouse.jpg"
Timer1.Enabled = False

End Sub


Private Sub Timer1_Timer()
r = 0
Label3.Caption = r & 1 + Val(Me.Label3.Caption)
    If Label3.Caption = 10 Then
    Timer1.Enabled = False
Picture1.Picture = LoadPicture()
Picture2.Picture = LoadPicture()
Picture3.Picture = LoadPicture()
Picture4.Picture = LoadPicture()
Picture5.Picture = LoadPicture()
Picture6.Picture = LoadPicture()
Picture7.Picture = LoadPicture()
Picture8.Picture = LoadPicture()
Picture9.Picture = LoadPicture()
Picture10.Picture = LoadPicture()
Picture11.Picture = LoadPicture()
Picture12.Picture = LoadPicture()
End If

End Sub

Hey did you do a control array for the pictures?
You can use a control array for the pics so you don't need to create 12 picture objects, you make one and then insert another with the same name. VB will ask you if you want to create an array, so click ok and you'll see that VB will create, for each picture object, an index. So you can make a select case with the index, and that will simplify your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.