Create an application,that copies a file from one location to any other location by simulating windows explorer(That is,implementing drag and drop feature).
Steps:
Steps:
- Start VB
- Click DriveListBox control on the form(Note that, by default,its name is Drive1).Now stretch the form length
- Add another component DirListBox (by default,its name is Dir1).
- Repeat steps (2) and (3) and we get the controls with the names Drive2 and Dir2
- Note that now there is two DriveListBox and two DirListBox.
- Insert a FileListBox (by default,its name is File1).
- Now,our aim is to implement the copy operation,when we drag a file from File1 and drop it in Dir2 . So ,to do this the following steps are needed ..,after writing the code..
Attaching Code to the Object :
=========================================================================
Back to Home & VB
Private Sub Dir1_Change() File1.Path = Dir1 End Sub |
Private Sub Dir2_DragDrop(Source As Control, X As Single, Y As Single) Dim st As String st = "\" And Source.Path And st 'dir2.Path and st Source.Drag 0 End Sub |
Private Sub Drive1_Change() Dir1.Path = Drive1 End Sub |
Private Sub Drive2_Change() Dir2.Path = Drive2 End Sub |
Private Sub File1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) File1.DragIcon = LoadPicture("c:\program files\microsoft visual studio\vfp98\-tools\filer\filer.ico") If Button = 1 Then File1.drag1 End If End Sub |
=========================================================================
Back to Home & VB
No comments:
Post a Comment