|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Richtextbox SaveFile ReleaseI am using the following code to add text to a RichTextBox: rtfLog.AppendText("File not Found: " & MyPath & MySubPath & "\" & ArtikelTempStr & ".pdf" & Chr(10)): Next step is to save the Richtextbox.text as file with the following code: rtfLog.SaveFile(ErrorDir & "\" & LogFileName & ".log", RichTextBoxStreamType.PlainText) The file is created and is exactly as I want it, but... When I hit the execute button on the form again, the file is locked (being used by another process). If I restart the program the file is released and it can be overwritten< but thet is NOT my intention, the program will work 24/7 an may not have to be restarted every time it has don something. Can anyone tell me what i can do to release the file and re-use or delete the file? I hope anyone of you out there has a solution or workaround for me. Thanks in advance. i, myself, like to stay away from those "SaveAllText" methods in files. I
prefer to use a FileStream and StreamWriter objects.... Dim fs As New System.IO.FileStream("C:\Log.txt", FileAccess.Append, FileMode.Write) ''This is off the top of my head....it could be FileMode.Append also... Dim sw As New System.IO.StreamWriter(fs) Dim s As String = "Stuff Here" sw.WriteLine(s) sw.Close() fs.Close() hope this helps -- -iwdu15
task manager, app doesn't unload
Best way to handle interface and Forms Why does the the program not quit in this case? Look at this debugging output about TreeViews How to prevent keydown events on toolbar Apostrophe Problem - HELP Excel dll on computer whitout offices Visual Basic 2005 - ContextSwitchDeadLock was detected when debugging VB.NET Problem: Setting the Mask and Picture Properties on a CommadBar without "LoadPicture"??? In VB.NET what do I need to "import" to get stdole ? |
|||||||||||||||||||||||