Ik wil wachten tot een bestand gecreeerd is hem dan verplaatsen. Het probleem waar ik tegen aan loop is dat het bestand nog 'in de maak' is, als ik hem probeer te kopieeren of te verplaatsen.
Mijn code:
Mijn code:
Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| With Timer1 .Interval = 30000 .AutoReset = False .Enabled = True Dim PDF As String = Path.GetFullPath(Export) + "\" + Path.GetFileNameWithoutExtension(Source) + ".pdf" Log.AppendLine("PDF File: " + PDF) While Not File.Exists(PDF) And Timer1.Enabled = True 'Wait for file to be created End While Timer1.Enabled = False If File.Exists(PDF) Then File.Copy(PDF, Dest) End If Try File.Delete(PDF) Catch ex As Exception Log.AppendLine("Unable to delete: " + PDF) End Try End With |