Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Drag&drop-swapping

Posted on 1998-06-16
2
Medium Priority
?
156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 150 total points
ID: 1463436
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
ID: 1463437
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

705 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