Solved

Drag&drop-swapping

Posted on 1998-06-16
2
150 Views
Last Modified: 2010-05-03
I am using....
Private Sub Picture12_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is PictureBox Then
        Picture12.Picture = Source.Picture
    End If
End Sub
.....to drag and drop an image from one box to another.

How can I swap the images, so that the the image in the drop box is pasted into the source box?
0
Comment
Question by:PerryBond
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 50 total points
Comment Utility
You will need a third picture box.
Set the AutoRedraw property to True.
Set the Visible property to False.

Then:
Private Sub Picture12_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is PictureBox Then
        PictureTemp.Picture = Picture12.Picture
        Picture12.Picture = Source.Picture
        Source.Picture = PictureTemp.Picture
    End If
End Sub

0
 
LVL 6

Expert Comment

by:clifABB
Comment Utility
The above is the easy answer.

Alternately, you could use the API to create what amounts to a picturebox in memory and then use that instead.  But the above will work in most instances and, because it's visible property is set to false, it won't use much more resources than using the API calls.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Extract Data and filename Macro 20 98
MsgBox 2 36
Determine Range to Select 5 33
Excel - Save a copy of work book 13 79
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now