Text file into textbox

Joined
Nov 12, 2003
Messages
10
hi - firstly can i say hello to all members as this is my first time here etc etc. :D


im very interested in the code snippit to do the text file 2 text box thing, i have tryed a few different things etc but i cant seem to get it working.. im doing something wrong..

is there anychance of somebody posting it here

also a auto updated version would be great , so it updates the textbox auto as the source .txt file is updated ( as it a log file im am trying to send to the text box

TIA ;)
 
thanks for the help / replys :)

here is the code i am using at the moment :

----------------------------------------------------------------

Try
Dim file_name As String = Application.StartupPath() _
& "/test.txt"
Dim stream_reader As New IO.StreamReader(file_name)

txtFileContents.Text = stream_reader.ReadToEnd()
txtFileContents.Select(0, 0)
stream_reader.Close()
Catch exc As System.IO.FileNotFoundException
Ignore this error.
Catch exc As Exception
Report other errors.
MsgBox(exc.Message, MsgBoxStyle.Exclamation, "Read " & _
"Error")
End Try

-----------------------------------------------

i need to send the test.txt file data to a textbox and if possible update the textbox as the test.txt file is updated by another program ( the test.txt is a programs log file )

thanks. :)

update : - i am using VB.Net 2003
 
Back
Top