Results 1 to 3 of 3

Thread: How to Kill a File

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Location
    London, England
    Posts
    213

    Post

    I have a list box which contains several files and a picture of a Trash bin underneath.

    I have written some code to Drag and Drop the files into a second list box. However, I also want to be able to drag the file below so that when it touches the Trash Bin Picture, the file is deleted.

    How do I kill the file when it reaches the picture ?


  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Code:
    Kill filepath
    i.e. Kill "c:\command.com"

    ------------------
    DiGiTaIErRoR

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this. Change the DragIcon property of the Listbox to the appropriate picture.

    Code:
    Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        List1.Drag vbBeginDrag
    End Sub
    
    Private Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
        On Error Resume Next
        
        Kill List1.List(List1.ListIndex)
        List1.RemoveItem List1.ListIndex
    End Sub
    Assuming that the Listbox has the files with the complete path (e.g. C:\MyFolder\MyFile.txt)

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819



    [This message has been edited by Serge (edited 12-03-1999).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width