I will now begin to compile my codes which had been very helpful to my work. The following code is used to read or write textfile which can be used for more creative output.
Imports System.IO
Public Class ReadWriteTextFile
Friend Sub WriteTextFile(ByVal filename As String, ByVal filecontent As String)
Try
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
oWrite = oFile.CreateText(filename)
oWrite.Write(filecontent)
oWrite.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Friend Function GetFileContents(ByVal FullPath As String)
Try
Dim strContents As String
Dim objReader As System.IO.StreamReader
objReader = New StreamReader(FullPath)
strContents = objReader.ReadToEnd()
objReader.Close()
Return strContents
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Function
End Class
No comments:
Post a Comment