I am successfully displaying the content of an external text file in a textbox txtWelcomeMessage. The problem is, it only displays the first 120 or so characters from the text file. I upped the MaxLength property on the textbox but it makes no difference, I think it has to do with the variable being declared as a string. Any suggestion would be helpful, as I am a newbie at VB.
Here's my code:
Dim strFile As String = "WelcomeMessage.txt"
'=========================================
Private Sub btnSaveChanges_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveChanges.Click
' The output file is written in the same file
Dim tFile As StreamWriter = File.CreateText(strFile)
tFile.WriteLine(txtWelcomeMessage.Text)
tFile.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Populate textbox1 on program load
Dim tFile As StreamReader = File.OpenText(strFile)
txtWelcomeMessage.Text = tFile.ReadLine()
tFile.Close()
End Sub
Mark Van
EZ-PC Help
Here's my code:
Dim strFile As String = "WelcomeMessage.txt"
'=========================================
Private Sub btnSaveChanges_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveChanges.Click
' The output file is written in the same file
Dim tFile As StreamWriter = File.CreateText(strFile)
tFile.WriteLine(txtWelcomeMessage.Text)
tFile.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Populate textbox1 on program load
Dim tFile As StreamReader = File.OpenText(strFile)
txtWelcomeMessage.Text = tFile.ReadLine()
tFile.Close()
End Sub
Mark Van
EZ-PC Help