just found an Oops in the code. I kept getting one of my favorite errors for files. It's about not being able to do anything with the file because it was in use by another process. And as I'm sure you all know, the other process is us. I always managed to fix it, but never understood how or why.
I guess code first:
You'll see that I have commented out the first "AppendText" line. This was the offending code. With that code being there, I had to close the file before I could write to it. Didn't make "any" sense to me. So I commented out that line and everything worked perfectly (before I was getting that exception). So if anyone reads this who is as dumb as me, this would be a good lesson. It really taught me a good oneCode:Dim writeFile As String = "tmpfile.txt" 'sw = AppendText(writeFile) For Each person As Contact In contacts Using sw sw = AppendText(writeFile) sw.WriteLine("Hello") End Using Next
thanks again everyone





Reply With Quote