I'm using vb 2008 express, during runtime, a temporary file is created and used, but I'd like my application to delete all the temp files when it closes, I've tried using:
System.IO.File.Delete("TempFile" & i.ToString)
but it keeps telling me access is denied. How can I fix this?
The files are created like this:
Using fs As New System.IO.FileStream("TempFile" & intTotal.ToString, IO.FileMode.Create)
fs.Write(FontResource, 0, FontResource.Length)
And then are loaded in the program like this:
'Use the resulting File as a font
pfc.AddFontFile("TempFile" & intTotal.ToString)
Return New Font(pfc.Families(FontIndex), intFontSize(FontIndex), fsStyle(FontIndex))
When I run the program again, it loads the same content that was created previously and doesn't allow me to change it, which is why I need to delete them when the program closes.