hi everyboy , im from morocco , and soory for my bad engish ,,, i want to make a simple game with 43 random images from imagelist , 43 buttons and 1 picturebox , so i want to make score displayed in textbox3 for every image in imagelist1 ,, for exemple:
and the same for other images
(this exemple codes is not correct)
,
so my codes
-----------
can someone help me pliz , thank u
Code:
if picturebox1.image= imagelist.images(0) then
textbox3.text+=13
when picturebox1.image= imagelist.images(1) then
textbox3.text+=5
when picturebox1.image= imagelist.images(3) then
textbox3.text+=40
and the same for other images
(this exemple codes is not correct)
,
so my codes
-----------
Code:
Public Class Form1
Private _images As New List(Of Image)
Private _unusedImages As New List(Of Image)
Private _ran As New Random
Private Function getImage() As Image
Dim indx As Integer
Dim rtn As Image = Nothing
If _unusedImages.Count > 0 Then
indx = _ran.Next(0, _unusedImages.Count)
rtn = _unusedImages.Item(indx)
_unusedImages.Remove(rtn)
End If
Return rtn
End Function
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Insert code to populate _images with the images that you want displayed
For Each img As Image In ImageList1.Images
_images.Add(img)
Next
_unusedImages.Clear()
_unusedImages.AddRange(_images)
End Sub
Private Sub Buttons_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click,
Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click,
Button8.Click, Button9.Click, Button10.Click, Button11.Click, Button12.Click, Button13.Click,
Button14.Click, Button15.Click, Button16.Click, Button17.Click, Button18.Click, Button19.Click,
Button20.Click, Button21.Click, Button22.Click, Button23.Click, Button24.Click, Button25.Click,
Button26.Click, Button27.Click, Button28.Click, Button29.Click, Button30.Click, Button31.Click,
Button32.Click, Button33.Click, Button34.Click, Button35.Click, Button36.Click, Button37.Click,
Button38.Click, Button39.Click, Button40.Click, Button41.Click, Button42.Click, Button43.Click, Button44.Click
CType(sender, Button).Visible = False
PictureBox1.Image = getImage()
End Sub
can someone help me pliz , thank u