R
Robert
Greetings
New to Visual Studio 2008.
Always us VB6.0 SP5.
I am trying to copy files from A to B.
I select a directory, and copy files. Works ok, but it does not create the
directory first.
snippet.
Private Sub cmdTo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdTo.Click
'Open the Dialog Box to Copy Files.
With FolderBrowserDialog1
..ShowNewFolderButton = True
..Description = "Select the Location for Files to be copied to."
..RootFolder = Environment.SpecialFolder.Desktop
End With
' If a file is not opened, then set the initial directory to the
' FolderBrowserDialog.SelectedPath value.
If lblTo.Text = "" Then
lblTo.Text = FolderBrowserDialog1.SelectedPath
lblTo.Text = Nothing
End If
' Display the openFile dialog.
Dim result As DialogResult = FolderBrowserDialog1.ShowDialog()
' OK button was pressed.
If (result = DialogResult.OK) Then
lblTo.Text = FolderBrowserDialog1.SelectedPath
' Cancel button was pressed.
ElseIf (result = DialogResult.Cancel) Then
Return
End If
Exit Sub
End Sub
Private Sub cmdCopy_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCopy.Click
''''My.Computer.FileSystem.CreateDirectory(lblTo.Text & "\" &
lblFrom.Text)"""" Does not work
My.Computer.FileSystem.CopyDirectory(lblFrom.Text, lblTo.Text, _
FileIO.UIOption.AllDialogs, FileIO.UICancelOption.DoNothing)
Exit Sub
I have added this line
My.Computer.FileSystem.CreateDirectory(lblTo.Text & "\" & lblFrom.Text)
Does not except this. In VB6 I could create a directory with from "\" to.
How do you create a directory, when selection is made.
New to Visual Studio 2008.
Always us VB6.0 SP5.
I am trying to copy files from A to B.
I select a directory, and copy files. Works ok, but it does not create the
directory first.
snippet.
Private Sub cmdTo_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdTo.Click
'Open the Dialog Box to Copy Files.
With FolderBrowserDialog1
..ShowNewFolderButton = True
..Description = "Select the Location for Files to be copied to."
..RootFolder = Environment.SpecialFolder.Desktop
End With
' If a file is not opened, then set the initial directory to the
' FolderBrowserDialog.SelectedPath value.
If lblTo.Text = "" Then
lblTo.Text = FolderBrowserDialog1.SelectedPath
lblTo.Text = Nothing
End If
' Display the openFile dialog.
Dim result As DialogResult = FolderBrowserDialog1.ShowDialog()
' OK button was pressed.
If (result = DialogResult.OK) Then
lblTo.Text = FolderBrowserDialog1.SelectedPath
' Cancel button was pressed.
ElseIf (result = DialogResult.Cancel) Then
Return
End If
Exit Sub
End Sub
Private Sub cmdCopy_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCopy.Click
''''My.Computer.FileSystem.CreateDirectory(lblTo.Text & "\" &
lblFrom.Text)"""" Does not work
My.Computer.FileSystem.CopyDirectory(lblFrom.Text, lblTo.Text, _
FileIO.UIOption.AllDialogs, FileIO.UICancelOption.DoNothing)
Exit Sub
I have added this line
My.Computer.FileSystem.CreateDirectory(lblTo.Text & "\" & lblFrom.Text)
Does not except this. In VB6 I could create a directory with from "\" to.
How do you create a directory, when selection is made.