Private Sub CreateChart()
Dim time2, tp As String
Try
Dim sr2 As New StreamReader("D:\Temp\datalogger\" & date1.ToString & "\int_sma_" + date1.ToString + ".txt")
Dim line7 = sr2.ReadLine
Dim tn = timeNow()
Do While Not line7 Is Nothing 'loop until end of file
If IsNumeric(line7.Chars(0)) Then
If Directory.Exists("D:\Temp\datalogger\" & date1) Then
If File.Exists("D:\Temp\datalogger\" & date1 & "\int_sma_" & date1 & ".txt") Then
Dim k = sr2.ReadToEnd
Dim y = k.Clone
Dim fields3() = Split(k.Substring(k.IndexOf(tn)), ";")
Dim fields2() = Split(y.Substring(y.IndexOf(tn)), ";")
Dim fields6() = Split(line7, ";")
time2 = fields6(0)
tp = fields2(19) + fields3(53)
Chart1.Series("Totalpower").Points.AddXY(time2, tp)
sr2.Close()
End If
End If
End If
line7 = sr2.ReadLine
Loop
Catch ex As Exception
End Try