I have been using this function for years with no problem..now when i try to
open a file(contains XML)..it returns an empty string even though it has
text.  I have noticed that the XML  fie has some null charcaters at the
begining..any suggestion?



Public Shared Function GetFileContents(ByVal FullPath As String) As String
       Dim stream As FileStream = Nothing
       Dim strContents As String = String.Empty

        Try
            stream = File.Open(FullPath, FileMode.Open, FileAccess.Read)
            Dim Tin As System.IO.StreamReader = New
System.IO.StreamReader(stream)
            strContents = Tin.ReadToEnd()
            Tin.Close()
            stream.Close()

            Return strContents
        Catch ex As Exception
            Trace.WriteLine(ex.Message)
            Return ""
        Finally
            If Not stream Is Nothing Then
                stream.Close()
            End If
        End Try
    End Function



Is your website being IntelliXperienced?
<http://www.intellixperience.com/signup.aspx>   | www.yougoingmyway.com ?
regards
Anthony (*12QWERNB*)
Is your website being IntelliXperienced?
 


Reply via email to