Public Function ReadTextFromFile(ByVal Filename As String) As String
' Returns text from the specified file
On Error Resume Next
Dim strFileText As String
' Open the file and launch StreamReader object
Dim MyReader As System.IO.StreamReader = _
System.IO.File.OpenText(Filename)
' Read all text through to the end
strFileText = MyReader.ReadToEnd
' Close the stream
MyReader.Close()
' Return data
Return strFileText
End Function
' Returns text from the specified file
On Error Resume Next
Dim strFileText As String
' Open the file and launch StreamReader object
Dim MyReader As System.IO.StreamReader = _
System.IO.File.OpenText(Filename)
' Read all text through to the end
strFileText = MyReader.ReadToEnd
' Close the stream
MyReader.Close()
' Return data
Return strFileText
End Function
تعليقات
إرسال تعليق