Shannon Shang-I think therefore I am

We came here, you and I, to this place and this profession, to be great, to do great things, and give form to great dreams - and we have

Drag & Drop of Internet Links from IE to a List Control

Using OLE Drag and Drop, this control enables you to drag and drop any link from Internet Explorer (IE) directly to a list control. You can even drag the icon from the IE address bar so that the current Web page's URL is inserted into the list control!

Here is sample list control that get the Internet link from Internet Explorer.

1.Start a new Visual Basic Standard EXE project. Form1 is created by default.

2.Add a ListBox (List1) to Form1.

3.Add the following code to the  Form1:
Private Sub Form_Load()
     'set the OLEDropMode property to Manual from default(None) 
      List1.OLEDropMode = 1

End Sub



Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)

        Dim str As String
        str = Data.GetData(vbCFText)
        If Data.GetFormat(vbCFText) And UCase(Left(Data.GetData(vbCFText), 7)) = "HTTP://" Then _
        List1.AddItem Data.GetData(vbCFText)

End Sub

4.Start the program or press the F5 key,and try to drag a link from Internet Explorer to List1.

Comments

ch21st said:

ggg
# June 27, 2004 11:50 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)