How to drag & drop into a listview

Posted on 2003-02-27
Medium Priority
Last Modified: 2008-03-10
I am not familiar with the drag & drop process and I need help.

Can someone show me the code on how to drag from the address bar of the internet explorer and drop it into the listview ? When it is dropped into the listview set at 'lvwreport for view' it will display the address of the link in column 1.
Example: http://www.experts-exchange.com
Also I only want links from the address bar to be added to the listview. How can I prevent anything else from being dropped into the listview ?
Question by:bshoenhair
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

Accepted Solution

M.E.Pierce earned 300 total points
ID: 8040934
Not sure on the prevention of other sources,
But to gain access to the dragged item:

Set your listview's OLE_DropMode to 1(Manual)

in the listviews OLEDragDrop put the following code:

'Format 1 is text:
'if it's not text,we don't want it
if Not Data.GetFormat(1) then Exit Sub

Dim theURL as string

theURL = Data.GetData(1)

the variable theURL will now contain the text of the link.
add it to your listview's list.

Author Comment

ID: 8046851
This will not post certain links. Is there another way that will add all the links that are dropped into the listview ? I only seem to be getting about 80% of them with the code you posted.

Expert Comment

ID: 8051501

That's strange, the code posted is the standard OLE Drag & Drop code, so it should catch every link you drop.
Let me investigate this and I'll get back to you.

Author Comment

ID: 8065975
I must apologize the code you posted works fine. I changed a few things in my code and it works perfectly. Thanks for the help.

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

777 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