Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Monday, June 27, 2011

VB-24 : Copies files from one location to other

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:

  1. Start VB
  2. Click DriveListBox control on the form(Note that, by default,its name is Drive1).Now stretch the form length
  3. Add another component DirListBox (by default,its name is Dir1).
  4. Repeat steps (2) and (3) and we get the controls with the names  Drive2 and Dir2
  5. Note that now there is two DriveListBox and two DirListBox.
  6. Insert a FileListBox  (by default,its name is File1).
  7. 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 :




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: