URGENT coding help required.

Hi ive got every thing the way i want it but have problems with some code (probly only about two lines.)

I have a text file (.txt) in my project but dont know the code to get it to open. when a button is clicked.

Please reply ASAP to aitken91@msn.com

Iain Aitken




Answer this question

URGENT coding help required.

  • RajDas

    Simple single line of code...

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim FileContents As String = My.Computer.Filesystem.ReadAlltext("Test.txt")

    End Sub


  • js06

    Just how "urgent" was this



  • Jpmon1

    I marked spottys message as answer because i found it easy to understand and read. Thank You Spotty and sorry to the others who posted.

  • imj

    Programe was (And HAD to be) sent away today at noon. Very urgent due to the amout of form building and coding that had to be done.

  • NewName

    Dim FileContents As String

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    Dim tr As IO.TextReader = My.Computer.FileSystem.OpenTextFileReader("FilePath")

    FileContents = tr.ReadToEnd

    tr.Close()

    End Sub



  • URGENT coding help required.