OK, I'm new to VB.Net so forgive me if this was covered else where and my search foo was week.
I am trying to read data from a text file which is updated regularly by another program. I only want to read the new data which will then be passed off to another device(ControlLogix 5000). The code I have thus far is below, this will read all the data, but once it reaches the end it stops. The second bit of code should send the data to the PLC. I am using VB.Net 2010
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file_name As String = "C://Data/FileData.txt"
Dim textline As String
If System.IO.File.Exists(file_name) = True Then
Dim objReader As New System.IO.StreamReader(file_name, True)
Do While objReader.Peek <> -1
textline = textline & objReader.ReadLine() & vbNewLine
Loop
TextBox1.Text = textline
Else
MsgBox("File Does Not Exist")
End If
End Sub
End Class
Dim asciidata As String
asciidata = textline
SerialPort.Write(asciidata)