checking dragged items

DylanK122
09-17-2009, 06:19 PM
hello
i have a dragging image game where you match the image to the word by dragging the picture.

how is it possible to check if it is correct using tag for instance. I tried to test if the tag matched the label but cant get it to work. Then i want to display a mark or cross using visibility controls.
Iam using this:

Private Sub Image10_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
If TypeOf Source Is image Then

Image10(Index).Picture = Source.Picture

End If

Any suggestions? thanks in advance!

kassyopeia
09-17-2009, 09:21 PM
I think you'll have to explain this in more detail, I'd need more context to make sense of the code sample.

DylanK122
09-18-2009, 02:26 AM
thanks for helping and sorry i wasnt clearer. Iam making a game where they drag the pictures of animals in a corresponding named box. That works fine using the code above. Once the picture has been dropped and is in the new place, i want a way of checking whether it is the correct picture. I have read and tried matching tags and indexes to verify whether it is correct and display a tick or cross but Iam not having much luck.

Kinda like
IF image7.index(source) = image1.index (target) then
imgcorrect.visible = true
else imgincorrect.visible = true

if only it was that easy. (btw there are five in total)
thanks heaps

Hugh Lerwill
09-18-2009, 01:00 PM
I'm guessing the Image Controls and PictureBoxes are equal in number; if so put them both in Control Arrays so you'll have Image(o thru n) and PictureBox(0 thru n); then do something like;

Private Sub Image1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)

If TypeOf Source Is PictureBox Then
If Index = Source.Index Then 'success
Beep 'or do your stuff
Else
MsgBox "Wrong Choice. Please try again"
End If
End If

End Sub

DylanK122
09-19-2009, 12:34 AM
Thank you so much for your help. Much appreciated.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum