Solved

Drag&drop-swapping

Posted on 1998-06-16
2
155 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 50 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 7 hours left to enroll

621 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