I'm getting a problem when writing text files using StreamWriter. The files read fine and they write fine if I'm not overwriting an existing file. They also write ok as long as I'm not writing over a file that only has one digit at the end of the name. For some reason when there are 2 digits at the end it crashes when I'm trying to save over an already existing text file. Here's my code.

Code:
      StringForTextFile = "C:\" & Folder4PS & "\" & IDCodewDashOrN & "Series" & Series & "ScreenNumber" & ScreenNumber & ".txt"
        LblTesting.Visible = True ' Testing
        LblTesting.Text = "StringForTextFile = " & StringForTextFile
        If File.Exists(StringForTextFile) = True Then
            Dim PerScrnsData As StreamWriter '                 False becasue will overwrite over already existing file
            PerScrnsData = New StreamWriter(StringForTextFile, False, Encoding.UTF8) '
            AcceptSettings()
            PerScrnsData.Write(PersonalScreensDataToStringAll())
            PerScrnsData.Close()
        Else
            Dim PerScrnsData As StreamWriter '                 True because will write new file that doesn't exist
            PerScrnsData = New StreamWriter(StringForTextFile, True, Encoding.UTF8) '
            AcceptSettings()
            PerScrnsData.Write(PersonalScreensDataToStringAll())
            PerScrnsData.Close()
        End If
I have PerScrnsData = New StreamWriter(StringForTextFile, False, Encoding.UTF8) above but 've tried all the different Encoding possibilites. Unicode, UTF32, UTF8, UTF7 as well as without those parameters listed where the close parentheses is right after StringForTextFile. I get the same result. If I'm writing a new text file that doesn't exist, then no problem or if I'm writing over an existing text file but it has 0 to 9 at the end then I'm ok but if I'm writing over an existing file and there is 10 or above(haven't tried triple digits or all values) then my application crashes. You see the test label in the code above because I was looking at exactly what file it was trying to overwrite and it is just as it should be.

Should I be using a different procedure? An example of a string that would cause a crash for the string StringForTextFile would be :

C:\Name of My App\Series1ScreenNumber10.txt

If it was being written for the first time then no problem or if the 10 at the end was 0 to 9 then no problem also.

I've also tried and originally had it set up where there wasn't an If File.Exists(StringForTextFile) = True Then statement. It just always used the same code whether writing or overwriting and I wasn't having a problem that I remember. For some reason I started having a problem recently and I put the alternate methods of writing in.