RichTextBox lines setValue not updating!

  • Thread starter OmniTech via .NET 247
  • Start date

OmniTech via .NET 247

I am having trouble updating lines in a richtextbox. The rtb.lines.setvalue("text", linenumber) runs, but does not update the control in the form. The code follows...
This apps automatically updates an output screen with changes in the file when the file length changes..

Private Sub LoadFile()
Dim lineCount As Integer = 0
Dim line As String
Dim iLength As Integer

If File.Exists(gFile) Then
Dim fs As New FileStream(gFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
iLength = fs.Length
If iLength <> saveLength Then
Dim sr As StreamReader = New StreamReader(fs)
While sr.Peek >= 0
line = sr.ReadLine
If lineCount < slineCount Then
If line <> rtbOutPut.Lines.GetValue(lineCount) Then
PROBLEM CODE -> rtbOutPut.Lines.SetValue("line", lineCount)
End If
rtbOutPut.AppendText(line & vbNewLine)
End If
lineCount = lineCount + 1
End While
slineCount = lineCount - 1
saveLength = iLength
End If
saveLength = -1
End If
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question