M
Microsoft
I am trying to use the streamwriter to write to a text file
I declare the streamwriter publically at the beginning
im filename As String
Dim Drive As String
Dim oFile As System.IO.File
Dim ofile2 As System.IO.File
Dim nopatch As System.IO.StreamWriter
Dim error1 As System.IO.StreamWriter
Dim testfile As System.IO.StreamWriter
Dim dir As String
After a button click I try to write some data ased on conditions. The files
appear but they are empty. I check the values of the variables and they all
of text associated
'create the initial output files and directories
dir = TextBox3.Text & "\"
Directory.CreateDirectory(dir)
nopatch = oFile.CreateText(dir & "nopatch.txt")
error1 = ofile2.CreateText(dir & "error.txt")
testfile = oFile.CreateText("C:\output\test.txt")
testfile.WriteLine("test")
Actual Write process
Catch ex As Exception
exout = ex.ToString
errorout = computer & "," & servername & "," & exout
error1.WriteLine(errorout)
testfile.WriteLine("test")
testfile.WriteLine(errorout)
End Try
I declare the streamwriter publically at the beginning
im filename As String
Dim Drive As String
Dim oFile As System.IO.File
Dim ofile2 As System.IO.File
Dim nopatch As System.IO.StreamWriter
Dim error1 As System.IO.StreamWriter
Dim testfile As System.IO.StreamWriter
Dim dir As String
After a button click I try to write some data ased on conditions. The files
appear but they are empty. I check the values of the variables and they all
of text associated
'create the initial output files and directories
dir = TextBox3.Text & "\"
Directory.CreateDirectory(dir)
nopatch = oFile.CreateText(dir & "nopatch.txt")
error1 = ofile2.CreateText(dir & "error.txt")
testfile = oFile.CreateText("C:\output\test.txt")
testfile.WriteLine("test")
Actual Write process
Catch ex As Exception
exout = ex.ToString
errorout = computer & "," & servername & "," & exout
error1.WriteLine(errorout)
testfile.WriteLine("test")
testfile.WriteLine(errorout)
End Try