Click here to Skip to main content
16,018,653 members

Comments by Hacko123 (Top 3 by date)

Hacko123 23-Apr-16 20:42pm View    
how to make it read and apply this for each line and apply the rules for each line?

example of the text file i open and read below:
<line1> d1err./ error on machine
<line2> d1jam./ jam on machine
<line3>d1spe./
<line4>d2err./
<line5>d2jam./ jam on machine
<line6>d2spe./ machine needs maintenance

much appreciated
Hacko123 23-Apr-16 17:10pm View    
thanks for the help I took your advise and this is how it looks

'Each type of Message sent
Dim type1 As String = "d1err./"
Dim type2 As String = "d1jam./"
Dim type3 As String = "d1spe./"
Dim type4 As String = "d2err./"
Dim type5 As String = "d2jam./"
Dim type6 As String = "d2spe./"

<pre>
Dim fileReader As StreamReader = My.Computer.FileSystem.OpenTextFileReader("C:\\locatin1\\filetoshow.txt")
Dim stringReader As String = fileReader.ReadLine()

While stringReader <> Nothing
Dim LineStart As String = stringReader.Substring(0, 7)
Dim RestOfLine As String = stringReader.Substring(7)
' Perform your processing here...
If LineStart = type1 Then
Display1.Dis1RTB1.Clear()
Display1.Dis1RTB1.Text = RestOfLine
ElseIf LineStart = type2 Then
Display1.Dis1RTB2.Clear()
Display1.Dis1RTB2.Text = RestOfLine
ElseIf LineStart = type3 Then
Display1.Dis1RTB3.Clear()
Display1.Dis1RTB3.Text = RestOfLine
ElseIf LineStart = type4 Then
Display2.Dis2RTB1.Clear()
Display2.Dis2RTB1.Text = RestOfLine
ElseIf LineStart = type5 Then
Display2.Dis2RTB2.Clear()
Display2.Dis2RTB2.Text = RestOfLine
ElseIf LineStart = type6 Then
Display2.Dis2RTB3.Clear()
Display2.Dis2RTB3.Text = RestOfLine
End If
stringReader = fileReader.ReadLine()
End While
fileReader.Close()

Last 2 questions
1. will this read each line and apply the rules for each line?

example of the text file i open and read below:
<line1> d1err./ error on machine
<line2> d1jam./ jam on machine
<line3>d1spe./
<line4>d2err./
<line5>d2jam./ jam on machine
<line6>d2spe./ machine needs maintenance

much appreciated
Hacko123 23-Apr-16 17:08pm View    
thanks!