16. Write VB program for dragging and dropping multiple objects. (take two command buttons RESET and EXIT, and four image controls). When user click on reset button then all images will go to original position.


Private Sub Command1_Click()
For i = 1 To 4
Image1(i).Visible = True
Next
End Sub

Private Sub Command1_DragDrop(Source As Control, X As Single, Y As Single)
BadDrop Source

End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command2_DragDrop(Source As Control, X As Single, Y As Single)
BadDrop Source
End Sub

Private Sub Command2_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Source.Visible = False
End Sub

Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
Dim i As Integer
For i = 1 To 4
Image1(i).DragIcon = Image1(i).Picture
Next
End Sub

Private Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Source.Visible = False
End Sub

Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
Picture1.Picture = Source.Picture
End Sub
Private Sub BadDrop(Source)
Source.Visible = True
End Sub

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s