Click to See Complete Forum and Search --> : How to Kill a File
nmretd
Dec 2nd, 1999, 08:26 PM
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 ?
DiGiTaIErRoR
Dec 2nd, 1999, 08:45 PM
Kill filepath
i.e. Kill "c:\command.com"
------------------
DiGiTaIErRoR
Serge
Dec 2nd, 1999, 08:55 PM
Try this. Change the DragIcon property of the Listbox to the appropriate picture.
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 (http://www.icq.com/51055819)
[This message has been edited by Serge (edited 12-03-1999).]
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.