Private Sub WriteThis()
Dim T() As String = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, _
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, _
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}
Dim SolutionWriter As System.IO.StreamWriter
Dim Solution As String = ""
Dim SolutionFile As String = ""
Dim MyDocumentsPath As String = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim Folder As String = MyDocumentsPath & "\Solutions"
If IO.Directory.Exists(Folder) = False Then IO.Directory.CreateDirectory(Folder)
SolutionFile = Folder & "\" & "Test" & ".doc"
SolutionWriter = New StreamWriter(SolutionFile, False) [green]'Or true. You will want to look at it a decide.[/green]
For Z As Integer = 0 To 49 'Arrays start at 0
If T(Z) = "" Then
Solution += "."
Else
Solution += T(Z)
End If
Next
[green]'Generally you would use SolutionWriter.Write(Solution) instead of WriteLine,
'but I don't know what else you might be doing so WriteLine could be needed[/green]
SolutionWriter.WriteLine(Solution)
[green]'When you are finished with the file you have to close it.
'That would be why it is locked.[/green]
SolutionWriter.Close()
SolutionWriter = Nothing
MsgBox("Done") [green]'At some point in some way you want to tell yourself it is done. [/green]
End Sub