Home
Up
 

DRAG & DROP - a pseudo puzzle:

CONTROL OBJECTS REQUIRED:

bullet1 Form: FrmNorrkoping
bullet2 Image Control Arrays: Img_Source, Img_Target
bullet1 Image: Img_Reset
bullet1 Icon used in application title bar
bullet1 Command button: CmdReset

CODE & FUNCTIONS USED:

Control Name  
Img_Target Dragmode = Manual
Img_Source Dragmode = Automatic

Dim NumCorrect As Integer <-- this is defined in General

Dim Num_Correct As Integer

Private Sub Cmd_Reset_Click()
   
For i = 0 To 5
        Img_Target(i).Picture = Img_Reset.Picture
        Img_Source(i).Visible = True
    Next

    Num_Correct = 0

End Sub


Private Sub Form_Load()
    Num_Correct = 0
End Sub

Private Sub Img_Target_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
   
If Index = Source.Index Then
        Img_Target(Index).Picture = Source.Picture
        Source.Visible = False
        Num_Correct = Num_Correct + 1
    End If

    If Num_Correct = 6 Then
        Print Num_Correct
        MsgBox "Well Done", vbInformation, "Norrkoping-Sweden"
    End If

End Sub