B
Bre-x
Guest
Hello all,
It only copies the first file. What I am doing wrong?
Dim the_folder As String = qc_atts & qc_year & "\" & qc_ncr
Dim the_name As String = DateTime.Now.ToString("yyyy_MMdd_Hmmss.fff")
Dim myStream As System.IO.Stream = Nothing
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
openFileDialog1.FileName = "*.*"
openFileDialog1.Filter = "All (*.*, *.*) | *.*; *.*"
openFileDialog1.Multiselect = True
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Try
myStream = openFileDialog1.OpenFile()
If (myStream IsNot Nothing) Then
Do While myStream IsNot Nothing
System.IO.File.Copy(openFileDialog1.FileName.ToString.Trim, the_folder & "\" & the_name & "_" & System.IO.Path.GetFileName(openFileDialog1.FileName))
Loop
End If
Catch Ex As Exception
MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message, app_cia)
Finally
If (myStream IsNot Nothing) Then
myStream.Close()
End If
End Try
End If
Please Help
John
Continue reading...
It only copies the first file. What I am doing wrong?
Dim the_folder As String = qc_atts & qc_year & "\" & qc_ncr
Dim the_name As String = DateTime.Now.ToString("yyyy_MMdd_Hmmss.fff")
Dim myStream As System.IO.Stream = Nothing
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
openFileDialog1.FileName = "*.*"
openFileDialog1.Filter = "All (*.*, *.*) | *.*; *.*"
openFileDialog1.Multiselect = True
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Try
myStream = openFileDialog1.OpenFile()
If (myStream IsNot Nothing) Then
Do While myStream IsNot Nothing
System.IO.File.Copy(openFileDialog1.FileName.ToString.Trim, the_folder & "\" & the_name & "_" & System.IO.Path.GetFileName(openFileDialog1.FileName))
Loop
End If
Catch Ex As Exception
MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message, app_cia)
Finally
If (myStream IsNot Nothing) Then
myStream.Close()
End If
End Try
End If
Please Help
John
Continue reading...