Imports ZedGraph ' ########################################################### ' ########################################################### Public Class Form_XY_Curves Dim list0 = New PointPairList() Dim list1 = New PointPairList() Dim list2 = New PointPairList() Dim list3 = New PointPairList() Dim list4 = New PointPairList() Dim list5 = New PointPairList() Dim list6 = New PointPairList() Dim list7 = New PointPairList() Dim list8 = New PointPairList() Dim list9 = New PointPairList() Dim list10 = New PointPairList() Dim list11 = New PointPairList() Dim list12 = New PointPairList() Dim list13 = New PointPairList() Dim list14 = New PointPairList() Dim list15 = New PointPairList() Dim list16 = New PointPairList() Dim list17 = New PointPairList() Dim iLegendCreated As Integer = 0 Dim CHANNELONE As Integer = 1 ' capital values indicate a constant Dim CHANNELTWO As Integer = 2 ' capital values indicate a constant Dim CHANNELTRE As Integer = 3 ' capital values indicate a constant Dim CHANNELFOR As Integer = 4 ' capital values indicate a constant Dim CHANNELFIV As Integer = 5 ' capital values indicate a constant Dim CHANNELSIX As Integer = 6 ' capital values indicate a constant Dim CHANNELSEV As Integer = 7 ' capital values indicate a constant Dim CHANNELATE As Integer = 8 ' capital values indicate a constant Dim CHANNELNIN As Integer = 9 ' capital values indicate a constant Dim CHANNELTEN As Integer = 10 ' capital values indicate a constant Dim CHANNELELE As Integer = 11 ' capital values indicate a constant Dim CHANNELTWV As Integer = 12 ' capital values indicate a constant Dim CHANNELTRT As Integer = 13 ' capital values indicate a constant Dim CHANNELFRT As Integer = 14 ' capital values indicate a constant Dim CHANNELFVT As Integer = 15 ' capital values indicate a constant Dim CHANNELSXT As Integer = 16 ' capital values indicate a constant Dim CHANNELSVT As Integer = 17 ' capital values indicate a constant Dim CHANNELATT As Integer = 18 ' capital values indicate a constant 'Dim MAXCURVEINDEX As Integer = (CHANNELTRT - 1) ' capital values indicate a constant Dim MAXCURVEINDEX As Integer = (CHANNELATT - 1) ' capital values indicate a constant 'Dim MAXCURVEINDEX As Integer = (6 - 1) ' capital values indicate a constant Dim iIndexCh(MAXCURVEINDEX) As Integer Dim iIndexOneDplpkt(MAXCURVEINDEX) As Integer Dim iIndexC(MAXCURVEINDEX) As Integer Dim strChannelNumber(MAXCURVEINDEX) As String Dim strTemperaturValue(MAXCURVEINDEX) As String Dim strFilePathNameOriginal As String = String.Empty Dim iChannelCounter As Integer Dim str_FunctionReply As String Public Sub New() ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. 'Me.Text = Me.Text & " Version: 12403a" 'Me.Text = Me.Text & " Version: 12612a" ' extended from 13 to 18 Curves 'Me.Text = Me.Text & " Version: 12824a" ' new ZedGraph V 515 'Me.Text = Me.Text & " Version: 12917a" ' added refresh Button 'Me.Text = Me.Text & " Version: 12a12a" ' reduced height for Archos9 TabletPC 'Me.Text = Me.Text & " Version: 13a07a" ' added ZedGraph.DLL properly as Reference 'Me.Text = Me.Text & " Version: 13a07b" ' changed >Sub< into >Function< 'Me.Text = Me.Text & " Version: 14401a" ' Switch to Visual Studio Express 2013 Me.Text = Me.Text & " Version: 14428b" ' without >My.Application.DoEvents()< End Sub Public Sub Form_XY_Curves_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.BackColor = Color.Beige XYPlot.Visible = True strFilePathNameOriginal = My.Computer.FileSystem.CurrentDirectory ofd_GetProtocollFile.InitialDirectory = strFilePathNameOriginal 'Call fctnCreateXYPlot() ' redraws XYPlot ZedGraph.ZedGraphControl str_FunctionReply = strfctn_CreateXYPlot() End Sub ' ########################################################### ' ########################################################### ' ================================================================== 'Public Sub fctnCreateXYPlot() Public Function strfctn_CreateXYPlot() Dim myPane As GraphPane = XYPlot.GraphPane ' Set the titles and axis labels myPane.Title.Text = "Temperatur-Verlauf" myPane.XAxis.Title.Text = "Minuten" myPane.YAxis.Title.Text = "Celsius" myPane.X2Axis.Title.Text = "Stunden" Dim list0 As New RollingPointPairList(1441) Dim list1 As New RollingPointPairList(1441) Dim list2 As New RollingPointPairList(1441) Dim list3 As New RollingPointPairList(1441) Dim list4 As New RollingPointPairList(1441) Dim list5 As New RollingPointPairList(1441) Dim list6 As New RollingPointPairList(1441) Dim list7 As New RollingPointPairList(1441) Dim list8 As New RollingPointPairList(1441) Dim list9 As New RollingPointPairList(1441) Dim list10 As New RollingPointPairList(1441) Dim list11 As New RollingPointPairList(1441) Dim list12 As New RollingPointPairList(1441) Dim list13 As New RollingPointPairList(1441) Dim list14 As New RollingPointPairList(1441) Dim list15 As New RollingPointPairList(1441) Dim list16 As New RollingPointPairList(1441) Dim list17 As New RollingPointPairList(1441) If iLegendCreated = 0 Then iLegendCreated = 1 Dim myCurve0 As LineItem = myPane.AddCurve("Ch 1", list0, Color.Brown, SymbolType.None) ' "Ch 1" Dim myCurve1 As LineItem = myPane.AddCurve("Ch 2", list1, Color.Red, SymbolType.None) Dim myCurve2 As LineItem = myPane.AddCurve("Ch 3", list2, Color.Orange, SymbolType.None) Dim myCurve3 As LineItem = myPane.AddCurve("Ch 4", list3, Color.Violet, SymbolType.None) Dim myCurve4 As LineItem = myPane.AddCurve("Ch 5", list4, Color.Green, SymbolType.None) Dim myCurve5 As LineItem = myPane.AddCurve("Ch 6", list5, Color.Blue, SymbolType.None) Dim myCurve6 As LineItem = myPane.AddCurve("Ch 7", list6, Color.Brown, SymbolType.None) Dim myCurve7 As LineItem = myPane.AddCurve("Ch 8", list7, Color.Red, SymbolType.None) Dim myCurve8 As LineItem = myPane.AddCurve("Ch 9", list8, Color.Orange, SymbolType.None) Dim myCurve9 As LineItem = myPane.AddCurve("Ch 10", list9, Color.Violet, SymbolType.None) Dim myCurve10 As LineItem = myPane.AddCurve("Ch 11", list10, Color.Green, SymbolType.None) Dim myCurve11 As LineItem = myPane.AddCurve("Ch 12", list11, Color.Blue, SymbolType.None) Dim myCurve12 As LineItem = myPane.AddCurve("Ch 13", list12, Color.Brown, SymbolType.None) ' "Ch 13" Dim myCurve13 As LineItem = myPane.AddCurve("Ch 14", list13, Color.Red, SymbolType.None) Dim myCurve14 As LineItem = myPane.AddCurve("Ch 15", list14, Color.Orange, SymbolType.None) Dim myCurve15 As LineItem = myPane.AddCurve("Ch 16", list15, Color.Violet, SymbolType.None) Dim myCurve16 As LineItem = myPane.AddCurve("Ch 17", list16, Color.Green, SymbolType.None) Dim myCurve17 As LineItem = myPane.AddCurve("Ch 18", list17, Color.Blue, SymbolType.None) myCurve0.Line.Width = 2.0 ' points myCurve1.Line.Width = 2.0 ' points myCurve2.Line.Width = 2.0 myCurve3.Line.Width = 2.0 myCurve4.Line.Width = 2.0 myCurve5.Line.Width = 2.0 myCurve6.Line.Width = 4.0 myCurve7.Line.Width = 4.0 myCurve8.Line.Width = 4.0 myCurve9.Line.Width = 4.0 myCurve10.Line.Width = 4.0 myCurve11.Line.Width = 4.0 myCurve12.Line.Width = 1.0 ' points myCurve13.Line.Width = 1.0 myCurve14.Line.Width = 1.0 myCurve15.Line.Width = 1.0 myCurve16.Line.Width = 1.0 myCurve17.Line.Width = 1.0 End If ' Fill the area under the curve with a white-red gradient at 45 degrees ' ## myCurve.Line.Fill = New Fill(Color.White, Color.Red, 45.0F) ' Make the symbols opaque by filling them with white 'myCurve0.Symbol.Fill = New Fill(Color.Red) 'myCurve1.Symbol.Fill = New Fill(Color.Orange) 'myCurve2.Symbol.Fill = New Fill(Color.Blue) 'myCurve3.Symbol.Fill = New Fill(Color.Green) 'myCurve4.Symbol.Fill = New Fill(Color.Black) 'myCurve5.Symbol.Fill = New Fill(Color.White) ' Fill the axis background with a color gradient 'myPane.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F) myPane.Chart.Fill = New Fill(Color.LightGray, Color.MistyRose, 45.0F) ' Fill the pane background with a color gradient 'myPane.Fill = New Fill(Color.Blue, Color.FromArgb(220, 220, 255), 45.0F) myPane.Fill = New Fill(Color.LightYellow, Color.FromArgb(220, 220, 255), 45.0F) ' Just manually control the X axis range so it scrolls continuously ' instead of discrete step-sized jumps myPane.XAxis.Scale.Min = 0 myPane.XAxis.Scale.Max = 1440 ' 24 * 60 myPane.XAxis.Scale.MinorStep = 1 myPane.XAxis.Scale.MajorStep = 10 myPane.XAxis.IsVisible = False myPane.YAxis.Scale.Min = -20 myPane.YAxis.Scale.Max = 120 myPane.YAxis.Scale.MinorStep = 1 myPane.YAxis.Scale.MajorStep = 10 myPane.YAxis.MajorGrid.IsVisible = True myPane.X2Axis.Scale.Min = 0 myPane.X2Axis.Scale.Max = myPane.XAxis.Scale.Max / 60 ' hourly tick myPane.X2Axis.Scale.MinorStep = 1 / 6 ' one tick every 10 minutes myPane.X2Axis.Scale.MajorStep = 1 myPane.X2Axis.IsVisible = True myPane.X2Axis.MajorGrid.IsVisible = True 'myPane.X2Axis.MajorGrid.PenWidth = 0 myPane.X2Axis.MajorGrid.PenWidth = 0 myPane.X2Axis.MajorGrid.IsZeroLine = True ' Calculate the Axis Scale Ranges XYPlot.AxisChange() XYPlot.Refresh() ' Force a redraw XYPlot.Invalidate() ' My.Application.DoEvents() strfctn_CreateXYPlot = "strfctn_CreateXYPlot is done" End Function ' ########################################################### ' ########################################################### Public Function floatfctn_ReadXYPlotData(ByVal iChannelIndex As Integer, ByVal iXAxis As Integer) ' iChannelIndex goes from "1" to "18"; iXAxis goes from 0 to 1440 Dim i_X_Coordinate As Integer Dim i_X0 As Integer Dim curve0 As CurveItem = XYPlot.GraphPane.CurveList.Item(0) Try Dim PP_XandY As PointPair = curve0(i_X_Coordinate) 'MsgBox("Curve0 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) i_X0 = PP_XandY.X floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Dim curve1 As CurveItem = XYPlot.GraphPane.CurveList.Item(0) Dim curve2 As CurveItem = XYPlot.GraphPane.CurveList.Item(1) Dim curve3 As CurveItem = XYPlot.GraphPane.CurveList.Item(2) Dim curve4 As CurveItem = XYPlot.GraphPane.CurveList.Item(3) Dim curve5 As CurveItem = XYPlot.GraphPane.CurveList.Item(4) Dim curve6 As CurveItem = XYPlot.GraphPane.CurveList.Item(5) Dim curve7 As CurveItem = XYPlot.GraphPane.CurveList.Item(6) Dim curve8 As CurveItem = XYPlot.GraphPane.CurveList.Item(7) Dim curve9 As CurveItem = XYPlot.GraphPane.CurveList.Item(8) Dim curve10 As CurveItem = XYPlot.GraphPane.CurveList.Item(9) Dim curve11 As CurveItem = XYPlot.GraphPane.CurveList.Item(10) Dim curve12 As CurveItem = XYPlot.GraphPane.CurveList.Item(11) Dim curve13 As CurveItem = XYPlot.GraphPane.CurveList.Item(12) Dim curve14 As CurveItem = XYPlot.GraphPane.CurveList.Item(13) Dim curve15 As CurveItem = XYPlot.GraphPane.CurveList.Item(14) Dim curve16 As CurveItem = XYPlot.GraphPane.CurveList.Item(15) Dim curve17 As CurveItem = XYPlot.GraphPane.CurveList.Item(16) Dim curve18 As CurveItem = XYPlot.GraphPane.CurveList.Item(17) i_X_Coordinate = iXAxis - i_X0 floatfctn_ReadXYPlotData = 1111.1 'Default Condition If (i_X_Coordinate < 0 Or i_X_Coordinate > (24 * 60)) Then floatfctn_ReadXYPlotData = 2222.2 'Error Condition Else Select Case iChannelIndex ' *************************************************************************************** Case 1 Try Dim PP_XandY As PointPair = curve1(i_X_Coordinate) 'MsgBox("Curve1 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve1(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 2 Try Dim PP_XandY As PointPair = curve2(i_X_Coordinate) 'MsgBox("Curve2 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve2(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 3 Try Dim PP_XandY As PointPair = curve3(i_X_Coordinate) 'MsgBox("Curve3 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve3(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 4 Try Dim PP_XandY As PointPair = curve4(i_X_Coordinate) 'MsgBox("Curve4 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve4(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 5 Try Dim PP_XandY As PointPair = curve5(i_X_Coordinate) 'MsgBox("Curve5 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve5(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 6 Try Dim PP_XandY As PointPair = curve6(i_X_Coordinate) 'MsgBox("Curve6 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve6(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try ' *************************************************************************************** ' *************************************************************************************** Case 7 Try Dim PP_XandY As PointPair = curve7(i_X_Coordinate) 'MsgBox("Curve7 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve7(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 8 Try Dim PP_XandY As PointPair = curve8(i_X_Coordinate) 'MsgBox("Curve8 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve8(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 9 Try Dim PP_XandY As PointPair = curve9(i_X_Coordinate) 'MsgBox("Curve9 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve9(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 10 Try Dim PP_XandY As PointPair = curve10(i_X_Coordinate) 'MsgBox("Curve10 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve10(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 11 Try Dim PP_XandY As PointPair = curve11(i_X_Coordinate) 'MsgBox("Curve11 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve11(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 12 Try Dim PP_XandY As PointPair = curve12(i_X_Coordinate) 'MsgBox("Curve12 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve12(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try ' *************************************************************************************** ' *************************************************************************************** Case 13 Try Dim PP_XandY As PointPair = curve13(i_X_Coordinate) 'MsgBox("Curve12 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve13(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 14 Try Dim PP_XandY As PointPair = curve14(i_X_Coordinate) 'MsgBox("Curve4 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve14(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 15 Try Dim PP_XandY As PointPair = curve15(i_X_Coordinate) 'MsgBox("Curve5 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve15(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 16 Try Dim PP_XandY As PointPair = curve16(i_X_Coordinate) 'MsgBox("Curve6 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve16(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 17 Try Dim PP_XandY As PointPair = curve17(i_X_Coordinate) 'MsgBox("Curve7 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve17(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try Case 18 Try Dim PP_XandY As PointPair = curve18(i_X_Coordinate) 'MsgBox("Curve8 i_X_Coordinate = " & i_X_Coordinate.ToString & " X = " & PP_XandY.X.ToString & " Y = " & PP_XandY.Y.ToString) floatfctn_ReadXYPlotData = PP_XandY.Y Catch ex As Exception If (i_X_Coordinate = 0) Then MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) Else Dim PP_XandY As PointPair = curve18(i_X_Coordinate - 1) ' uses previous value !!! floatfctn_ReadXYPlotData = PP_XandY.Y End If End Try ' *************************************************************************************** Case Else floatfctn_ReadXYPlotData = 999.9 'Error Condition End Select End If ' end of If(i_X_Coordinate < 0 Or i_X_Coordinate > (24 * 60)) Then End Function '*************************************** ' ########################################################### '*************************************** 'Call fctnWriteXYPlotData(Val(txt_DayIndex.Text), Val(strChannelNr), Val(strTemperaturValue)) ' in XYPlot '*************************************** 'Public Sub fctnWriteXYPlotData(ByVal iXAxis As Integer, ByVal iChannelIndex As Integer, ByVal dYAxis As Double) ' in XYPlot Public Function strfctn_WriteXYPlotData(ByVal iXAxis As Integer, ByVal iChannelIndex As Integer, ByVal dYAxis As Double) ' in XYPlot ' Make sure that the curvelist has at least one curve If XYPlot.GraphPane.CurveList.Count <= 0 Then Return "XYPlot.GraphPane.CurveList.Count <= 0" ' 30.03.2012 ' Get the first CurveItem in the graph Dim mycurve0 As LineItem = XYPlot.GraphPane.CurveList(0) If mycurve0 Is Nothing Then Return "mycurve0 Is Nothing" Dim mycurve1 As LineItem = XYPlot.GraphPane.CurveList(1) If mycurve1 Is Nothing Then Return "mycurve1 Is Nothing" Dim mycurve2 As LineItem = XYPlot.GraphPane.CurveList(2) If mycurve2 Is Nothing Then Return "mycurve2 Is Nothing" Dim mycurve3 As LineItem = XYPlot.GraphPane.CurveList(3) If mycurve3 Is Nothing Then Return "mycurve3 Is Nothing" Dim mycurve4 As LineItem = XYPlot.GraphPane.CurveList(4) If mycurve4 Is Nothing Then Return "mycurve4 Is Nothing" Dim mycurve5 As LineItem = XYPlot.GraphPane.CurveList(5) If mycurve5 Is Nothing Then Return "mycurve5 Is Nothing" Dim mycurve6 As LineItem = XYPlot.GraphPane.CurveList(6) If mycurve6 Is Nothing Then Return "mycurve6 Is Nothing" Dim mycurve7 As LineItem = XYPlot.GraphPane.CurveList(7) If mycurve7 Is Nothing Then Return "mycurve7 Is Nothing" Dim mycurve8 As LineItem = XYPlot.GraphPane.CurveList(8) If mycurve8 Is Nothing Then Return "mycurve8 Is Nothing" Dim mycurve9 As LineItem = XYPlot.GraphPane.CurveList(9) If mycurve9 Is Nothing Then Return "mycurve9 Is Nothing" Dim mycurve10 As LineItem = XYPlot.GraphPane.CurveList(10) If mycurve10 Is Nothing Then Return "mycurve10 Is Nothing" Dim mycurve11 As LineItem = XYPlot.GraphPane.CurveList(11) If mycurve11 Is Nothing Then Return "mycurve11 Is Nothing" Dim mycurve12 As LineItem = XYPlot.GraphPane.CurveList(12) If mycurve12 Is Nothing Then Return "mycurve12 Is Nothing" Dim mycurve13 As LineItem = XYPlot.GraphPane.CurveList(13) If mycurve13 Is Nothing Then Return "mycurve13 Is Nothing" Dim mycurve14 As LineItem = XYPlot.GraphPane.CurveList(14) If mycurve14 Is Nothing Then Return "mycurve14 Is Nothing" Dim mycurve15 As LineItem = XYPlot.GraphPane.CurveList(15) If mycurve15 Is Nothing Then Return "mycurve15 Is Nothing" Dim mycurve16 As LineItem = XYPlot.GraphPane.CurveList(16) If mycurve16 Is Nothing Then Return "mycurve16 Is Nothing" Dim mycurve17 As LineItem = XYPlot.GraphPane.CurveList(17) If mycurve17 Is Nothing Then Return "mycurve17 Is Nothing" ' Get the PointPairList ' If this is null, it means the reference at curve.Points does not ' support IPointListEdit, so we won't be able to modify it Dim list0 As IPointListEdit = mycurve0.Points If list0 Is Nothing Then Return "list0 Is Nothing" Dim list1 As IPointListEdit = mycurve1.Points If list1 Is Nothing Then Return "list1 Is Nothing" Dim list2 As IPointListEdit = mycurve2.Points If list2 Is Nothing Then Return "list2 Is Nothing" Dim list3 As IPointListEdit = mycurve3.Points If list3 Is Nothing Then Return "list3 Is Nothing" Dim list4 As IPointListEdit = mycurve4.Points If list4 Is Nothing Then Return "list4 Is Nothing" Dim list5 As IPointListEdit = mycurve5.Points If list5 Is Nothing Then Return "list5 Is Nothing" Dim list6 As IPointListEdit = mycurve6.Points If list6 Is Nothing Then Return "list6 Is Nothing" Dim list7 As IPointListEdit = mycurve7.Points If list7 Is Nothing Then Return "list7 Is Nothing" Dim list8 As IPointListEdit = mycurve8.Points If list8 Is Nothing Then Return "list8 Is Nothing" Dim list9 As IPointListEdit = mycurve9.Points If list9 Is Nothing Then Return "list9 Is Nothing" Dim list10 As IPointListEdit = mycurve10.Points If list10 Is Nothing Then Return "list10 Is Nothing" Dim list11 As IPointListEdit = mycurve11.Points If list11 Is Nothing Then Return "list11 Is Nothing" Dim list12 As IPointListEdit = mycurve12.Points If list12 Is Nothing Then Return "list12 Is Nothing" Dim list13 As IPointListEdit = mycurve13.Points If list13 Is Nothing Then Return "list13 Is Nothing" Dim list14 As IPointListEdit = mycurve14.Points If list14 Is Nothing Then Return "list14 Is Nothing" Dim list15 As IPointListEdit = mycurve15.Points If list15 Is Nothing Then Return "list15 Is Nothing" Dim list16 As IPointListEdit = mycurve16.Points If list16 Is Nothing Then Return "list16 Is Nothing" Dim list17 As IPointListEdit = mycurve17.Points If list17 Is Nothing Then Return "list17 Is Nothing" If iChannelIndex = 1 Then list0.Add(iXAxis, dYAxis) If iChannelIndex = 2 Then list1.Add(iXAxis, dYAxis) If iChannelIndex = 3 Then list2.Add(iXAxis, dYAxis) If iChannelIndex = 4 Then list3.Add(iXAxis, dYAxis) If iChannelIndex = 5 Then list4.Add(iXAxis, dYAxis) If iChannelIndex = 6 Then list5.Add(iXAxis, dYAxis) If iChannelIndex = 7 Then list6.Add(iXAxis, dYAxis) If iChannelIndex = 8 Then list7.Add(iXAxis, dYAxis) If iChannelIndex = 9 Then list8.Add(iXAxis, dYAxis) If iChannelIndex = 10 Then list9.Add(iXAxis, dYAxis) If iChannelIndex = 11 Then list10.Add(iXAxis, dYAxis) If iChannelIndex = 12 Then list11.Add(iXAxis, dYAxis) If iChannelIndex = 13 Then list12.Add(iXAxis, dYAxis) If iChannelIndex = 14 Then list13.Add(iXAxis, dYAxis) If iChannelIndex = 15 Then list14.Add(iXAxis, dYAxis) If iChannelIndex = 16 Then list15.Add(iXAxis, dYAxis) If iChannelIndex = 17 Then list16.Add(iXAxis, dYAxis) If iChannelIndex = 18 Then list17.Add(iXAxis, dYAxis) strfctn_WriteXYPlotData = "strfctn_WriteXYPlotData is done" End Function ' ########################################################### ' ########################################################### 'Public Sub fctnClearXYPlot() Public Function strfctn_ClearXYPlot() ' Get the first CurveItem in the graph Dim mycurve0 As LineItem = XYPlot.GraphPane.CurveList(0) If mycurve0 Is Nothing Then Return "mycurve0 Is Nothing" Dim mycurve1 As LineItem = XYPlot.GraphPane.CurveList(1) If mycurve1 Is Nothing Then Return "mycurve1 Is Nothing" Dim mycurve2 As LineItem = XYPlot.GraphPane.CurveList(2) If mycurve2 Is Nothing Then Return "mycurve2 Is Nothing" Dim mycurve3 As LineItem = XYPlot.GraphPane.CurveList(3) If mycurve3 Is Nothing Then Return "mycurve3 Is Nothing" Dim mycurve4 As LineItem = XYPlot.GraphPane.CurveList(4) If mycurve4 Is Nothing Then Return "mycurve4 Is Nothing" Dim mycurve5 As LineItem = XYPlot.GraphPane.CurveList(5) If mycurve5 Is Nothing Then Return "mycurve5 Is Nothing" Dim mycurve6 As LineItem = XYPlot.GraphPane.CurveList(6) If mycurve6 Is Nothing Then Return "mycurve6 Is Nothing" Dim mycurve7 As LineItem = XYPlot.GraphPane.CurveList(7) If mycurve7 Is Nothing Then Return "mycurve7 Is Nothing" Dim mycurve8 As LineItem = XYPlot.GraphPane.CurveList(8) If mycurve8 Is Nothing Then Return "mycurve8 Is Nothing" Dim mycurve9 As LineItem = XYPlot.GraphPane.CurveList(9) If mycurve9 Is Nothing Then Return "mycurve9 Is Nothing" Dim mycurve10 As LineItem = XYPlot.GraphPane.CurveList(10) If mycurve10 Is Nothing Then Return "mycurve10 Is Nothing" Dim mycurve11 As LineItem = XYPlot.GraphPane.CurveList(11) If mycurve11 Is Nothing Then Return "mycurve11 Is Nothing" Dim mycurve12 As LineItem = XYPlot.GraphPane.CurveList(12) If mycurve12 Is Nothing Then Return "mycurve12 Is Nothing" Dim mycurve13 As LineItem = XYPlot.GraphPane.CurveList(13) If mycurve13 Is Nothing Then Return "mycurve13 Is Nothing" Dim mycurve14 As LineItem = XYPlot.GraphPane.CurveList(14) If mycurve14 Is Nothing Then Return "mycurve14 Is Nothing" Dim mycurve15 As LineItem = XYPlot.GraphPane.CurveList(15) If mycurve15 Is Nothing Then Return "mycurve15 Is Nothing" Dim mycurve16 As LineItem = XYPlot.GraphPane.CurveList(16) If mycurve16 Is Nothing Then Return "mycurve16 Is Nothing" Dim mycurve17 As LineItem = XYPlot.GraphPane.CurveList(17) If mycurve17 Is Nothing Then Return "mycurve17 Is Nothing" ' Get the PointPairList ' If this is null, it means the reference at curve.Points does not ' support IPointListEdit, so we won't be able to modify it Dim list0 As IPointListEdit = mycurve0.Points If list0 Is Nothing Then Return "list0 Is Nothing" Dim list1 As IPointListEdit = mycurve1.Points If list1 Is Nothing Then Return "list1 Is Nothing" Dim list2 As IPointListEdit = mycurve2.Points If list2 Is Nothing Then Return "list2 Is Nothing" Dim list3 As IPointListEdit = mycurve3.Points If list3 Is Nothing Then Return "list3 Is Nothing" Dim list4 As IPointListEdit = mycurve4.Points If list4 Is Nothing Then Return "list4 Is Nothing" Dim list5 As IPointListEdit = mycurve5.Points If list5 Is Nothing Then Return "list5 Is Nothing" Dim list6 As IPointListEdit = mycurve6.Points If list6 Is Nothing Then Return "list6 Is Nothing" Dim list7 As IPointListEdit = mycurve7.Points If list7 Is Nothing Then Return "list7 Is Nothing" Dim list8 As IPointListEdit = mycurve8.Points If list2 Is Nothing Then Return "list2 Is Nothing" Dim list9 As IPointListEdit = mycurve9.Points If list9 Is Nothing Then Return "list9 Is Nothing" Dim list10 As IPointListEdit = mycurve10.Points If list10 Is Nothing Then Return "list10 Is Nothing" Dim list11 As IPointListEdit = mycurve11.Points If list11 Is Nothing Then Return "list11 Is Nothing" Dim list12 As IPointListEdit = mycurve12.Points If list12 Is Nothing Then Return "list12 Is Nothing" Dim list13 As IPointListEdit = mycurve13.Points If list13 Is Nothing Then Return "list13 Is Nothing" Dim list14 As IPointListEdit = mycurve14.Points If list14 Is Nothing Then Return "list14 Is Nothing" Dim list15 As IPointListEdit = mycurve15.Points If list15 Is Nothing Then Return "list15 Is Nothing" Dim list16 As IPointListEdit = mycurve16.Points If list16 Is Nothing Then Return "list16 Is Nothing" Dim list17 As IPointListEdit = mycurve17.Points If list17 Is Nothing Then Return "list17 Is Nothing" list0.Clear() list1.Clear() list2.Clear() list3.Clear() list4.Clear() list5.Clear() list6.Clear() list7.Clear() list8.Clear() list9.Clear() list10.Clear() list11.Clear() list12.Clear() list13.Clear() list14.Clear() list15.Clear() list16.Clear() list17.Clear() 'XYPlot.Refresh() ' My.Application.DoEvents() '' Force a redraw 'XYPlot.Invalidate() 'XYPlot.Refresh() 'Call fctn_RefreshPlot() str_FunctionReply = strfctn_RefreshPlot() strfctn_ClearXYPlot = "str_fctn_ClearXYPlot is done" End Function ' ########################################################### ' ########################################################### ' ********************************************************* ' ########################################################### ' ########################################################### ' ########################################################### ' ########################################################### Private Sub btn_FillData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_FillData.Click Dim i_Eye As Integer 'Me.Cursor = Cursors.WaitCursor Me.Cursor = Cursors.AppStarting For i_Eye = 1 To 1441 Step 1 ' Public Sub fctnWriteXYPlotData(ByVal iXAxis As Integer, ByVal iChannelIndex As Integer, ByVal dYAxis As Double) ' in XYPlot str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELONE, ((i_Eye / 10.292857142857143) - 20.0)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELTWO, (120.0 - (i_Eye / 10.292857142857143))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELTRE, (50 - 70 * Math.Cos(i_Eye / 20.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELFOR, (50 + 60 * Math.Cos(i_Eye / 20.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELFIV, (50 - 70 * Math.Sin(i_Eye / 40.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELSIX, (50 + 60 * Math.Sin(i_Eye / 40.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELSEV, ((i_Eye / 20.585714285714285) - 20.0)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELATE, (120.0 - (i_Eye / 20.585714285714285))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELNIN, (50 - 50 * Math.Cos((i_Eye + 10) / 60.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELTEN, (50 + 40 * Math.Cos((i_Eye + 5) / 60.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELELE, (50 - 50 * Math.Sin((i_Eye + 15) / 80.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELTWV, (50 + 30 * Math.Sin((i_Eye + 20) / 80.0))) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELTRT, (-15.0 + i_Eye / 72)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELFRT, (-5.0 + i_Eye / 72)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELFVT, (5.0 + i_Eye / 72)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELSXT, (15.0 + i_Eye / 72)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELSVT, (25.0 + i_Eye / 72)) str_FunctionReply = strfctn_WriteXYPlotData(i_Eye, CHANNELATT, (35.0 + i_Eye / 72)) Next i_Eye ' Force a redraw XYPlot.Invalidate() XYPlot.Refresh() ' My.Application.DoEvents() iChannelCounter = 18 Me.Cursor = Cursors.Default pnl_DataSearch.Visible = True End Sub ' ************************************************************************************ Private Sub btn_ClearData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ClearDisplay.Click 'Call fctnClearXYPlot() str_FunctionReply = strfctn_ClearXYPlot() pnl_DataSearch.Visible = False btn_SearchData.Visible = True End Sub ' ************************************************************************************ Private Sub btn_SearchData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_SearchData.Click Dim i_XValue As Integer Dim i_ChannNr As Integer i_XValue = Val(txt_XCoord.Text) i_ChannNr = Val(txt_Channel.Text) txt_Value.Text = vbEmpty If (i_XValue = 0 Or i_ChannNr = 0 Or i_ChannNr > iChannelCounter Or i_XValue > 1440) Then txt_Value.Text = " Value Error" Else txt_Value.Text = FormatNumber((floatfctn_ReadXYPlotData(i_ChannNr, i_XValue).ToString), 1) End If End Sub ' ************************************************************************************ Private Sub btnFileSearchShow_Click(sender As System.Object, e As System.EventArgs) Handles btnFileSearchShow.Click Dim strFilePathName As String = String.Empty Dim strfileContents As String = String.Empty Dim strFileName As String 'XYPlot.Dispose() 'Call fctnCreateXYPlot() ' redraws XYPlot ZedGraph.ZedGraphControl 'Call fctnClearXYPlot() str_FunctionReply = strfctn_ClearXYPlot() 'Call fctnCreateXYPlot() ' redraws XYPlot ZedGraph.ZedGraphControl str_FunctionReply = strfctn_CreateXYPlot() 'iLookingAtFileFlag = 1 'Set the Open dialog properties With ofd_GetProtocollFile .Filter = "Text Documents (*.txt)|*.txt|All Files (*.*)|*.*" .FilterIndex = 1 .Title = "Get Protocol Data" End With ' My.Application.DoEvents() 'Show the Open dialog and if the user clicks the Open button, 'load the file Select Case ofd_GetProtocollFile.ShowDialog Case Windows.Forms.DialogResult.OK Try 'Save the file path and name strFileName = ofd_GetProtocollFile.FileName txt_FileName.Text = strFileName strfileContents = My.Computer.FileSystem.ReadAllText(strFileName) 'Call fctnFillXYPlotData(strfileContents) str_FunctionReply = strfctn_FillXYPlotData(strfileContents) pnl_DataSearch.Visible = True Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Case Windows.Forms.DialogResult.Cancel 'Call fctnRestoreTodaysXYPlot() End Select End Sub ' ########################################################### ' ########################################################### ' ########################################################### ' ########################################################### ' ********************************************************* ' ########################################################### 'Public Sub fctnFillXYPlotData(ByVal strXYPlotData) Public Function strfctn_FillXYPlotData(ByVal strXYPlotData) Dim iPrimCount As Integer Dim iSekundaerCount As Integer Dim iTertiaerCount As Integer Dim iDummy As Integer Dim strXAxisIndex(24 * 60) As String Dim LngCounter As Long = 0 Dim iIndexTwoDplpkt(24 * 60) As Integer Dim iIndex_Delim(24 * 60) As Integer Dim iXAxisIndex((24 * 60) + 1) As Integer Dim LngEndPoint As Long = 0 Dim iDelta(24 * 60) As Integer 'Dim iChannelCounter As Integer Dim iDataBlockCounter As Integer ' moved to Declarations: 'Dim iIndexCh(MAXCURVEINDEX) As Integer 'Dim iIndexOneDplpkt(MAXCURVEINDEX) As Integer 'Dim iIndexC(MAXCURVEINDEX) As Integer 'Dim strChannelNumber(MAXCURVEINDEX) As String 'Dim strTemperaturValue(MAXCURVEINDEX) As String ' ####################################################### ' strXYPlotData has the following structure: '16:50:00 :: 1010 '#% 'bCh 1: 45.5 C 'cCh 2: 44.8 C 'dCh 3: 38.3 C 'eCh 4: 35.1 C 'fCh 5: 33.4 C 'gCh 6: 33.0 C ' 'bCh 7: 22.6 C 'cCh 8: 22.5 C 'dCh 9: 22.6 C 'eCh 10: 23.4 C 'fCh 11: 23.1 C 'gCh 12: 23.4 C '16:51:00 :: 1011 '#% 'bCh 1: 44.1 C 'cCh 2: 43.8 C 'dCh 3: 37.7 C 'eCh 4: 34.9 C 'fCh 5: 33.2 C 'gCh 6: 32.7 C ' 'bCh 7: 22.5 C 'cCh 8: 22.4 C 'dCh 9: 22.6 C 'eCh 10: 23.4 C 'fCh 11: 23.2 C 'gCh 12: 23.4 C '16:52:00 :: 1012 '#% 'bCh 1: 42.8 C 'cCh 2: 42.9 C 'dCh 3: 37.2 C 'eCh 4: 34.5 C 'fCh 5: 33.0 C 'gCh 6: 32.3 C ' 'bCh 7: 22.5 C 'cCh 8: 22.5 C 'dCh 9: 22.6 C 'eCh 10: 23.4 C 'fCh 11: 23.1 C 'gCh 12: 23.3 C ' ####################################### LngCounter = Len(strXYPlotData) ' 187682 Byte ' Looks for the first two ":" of the recorded Time iIndexOneDplpkt(0) = InStr(1, strXYPlotData, ":") iIndexOneDplpkt(1) = InStr((iIndexOneDplpkt(0) + 1), strXYPlotData, ":") iDummy = iIndexOneDplpkt(1) - iIndexOneDplpkt(0) ' checks the format of the time record ' Gives you the positions of the first two "::", i.e. the beginnings of the data sets iIndexTwoDplpkt(0) = InStr(1, strXYPlotData, "::") iIndexTwoDplpkt(1) = InStr((iIndexTwoDplpkt(0) + 1), strXYPlotData, "::") If (iIndexTwoDplpkt(0) = 0 Or iIndexTwoDplpkt(1) = 0 Or iDummy <> 3) Then MessageBox.Show("No or Wrong File", "File Error") Else iDataBlockCounter = 0 ' Finds the number of data channels in the records For iDummy = 1 To LngCounter Step 1 If (Mid(strXYPlotData, iDummy, 2) = "::") Then iDataBlockCounter += 1 End If Next iDummy LngEndPoint = iDataBlockCounter iChannelCounter = 0 ' Finds the number of data channels in the records For iDummy = iIndexTwoDplpkt(0) To iIndexTwoDplpkt(1) Step 1 If (Mid(strXYPlotData, iDummy, 2) = "Ch") Then iChannelCounter += 1 End If Next iDummy MAXCURVEINDEX = (iChannelCounter - 1) 'redefines the number of curves depending on curves available ' Finds index of the first data block iIndex_Delim(0) = InStr(iIndexTwoDplpkt(0), strXYPlotData, "#%") strXAxisIndex(0) = String.Empty For iPrimCount = 1 To LngEndPoint Step 1 iIndexTwoDplpkt(iPrimCount) = InStr(((iIndexTwoDplpkt(iPrimCount - 1)) + 1), strXYPlotData, "::") iIndex_Delim(iPrimCount) = InStr(((iIndexTwoDplpkt(iPrimCount - 1)) + 1), strXYPlotData, "#%") strXAxisIndex(iPrimCount) = Mid(strXYPlotData, (iIndexTwoDplpkt(iPrimCount - 1) + 2), (iIndex_Delim(iPrimCount) + 1 - iIndexTwoDplpkt(iPrimCount - 1) - 4)) iXAxisIndex(iPrimCount - 1) = Val(strXAxisIndex(iPrimCount)) ' a trap to find a previous error 'If iXAxisIndex(iPrimCount - 1) > 1136 Then ' iDummy = 0 'End If iIndexCh(0) = InStr((iIndex_Delim(iPrimCount) + 1), strXYPlotData, "Ch") iIndexOneDplpkt(0) = InStr((iIndexCh(0) + 1), strXYPlotData, ":") iIndexC(0) = InStr((iIndexOneDplpkt(0) + 1), strXYPlotData, "C") For iSekundaerCount = 1 To MAXCURVEINDEX Step 1 iIndexCh(iSekundaerCount) = InStr(iIndexCh(iSekundaerCount - 1) + 1, strXYPlotData, "Ch") iIndexOneDplpkt(iSekundaerCount) = InStr((iIndexCh(iSekundaerCount) + 1), strXYPlotData, ":") iIndexC(iSekundaerCount) = InStr((iIndexOneDplpkt(iSekundaerCount) + 1), strXYPlotData, "C") Next iSekundaerCount For iTertiaerCount = 0 To MAXCURVEINDEX Step 1 strChannelNumber(iTertiaerCount) = Mid(strXYPlotData, (iIndexCh(iTertiaerCount) + 2), (iIndexOneDplpkt(iTertiaerCount) - iIndexCh(iTertiaerCount) - 2)) strTemperaturValue(iTertiaerCount) = Mid(strXYPlotData, (iIndexOneDplpkt(iTertiaerCount) + 1), (iIndexC(iTertiaerCount) - iIndexOneDplpkt(iTertiaerCount) - 2)) str_FunctionReply = strfctn_WriteXYPlotData(iXAxisIndex(iPrimCount - 1), Val(strChannelNumber(iTertiaerCount)), Val(strTemperaturValue(iTertiaerCount))) ' in XYPlot Next iTertiaerCount Next iPrimCount ' Force a redraw XYPlot.Invalidate() XYPlot.Refresh() iDummy = 0 For iPrimCount = 0 To (LngEndPoint - 1) Step 1 iDelta(iPrimCount) = iXAxisIndex(iPrimCount + 1) - iXAxisIndex(iPrimCount) If (iDelta(iPrimCount) = 1) Then iDummy += 1 Next iPrimCount If (iDummy <> (iXAxisIndex(iPrimCount - 1) - iXAxisIndex(0))) Then 'MessageBox.Show("?", "??") btn_SearchData.Visible = False Else btn_SearchData.Visible = True End If End If 'If (iIndexTwoDplpkt(0) = 0 Or iIndexTwoDplpkt(1) = 0 Or iDummy <> 3) Then ' My.Application.DoEvents() My.Computer.FileSystem.CurrentDirectory = strFilePathNameOriginal strfctn_FillXYPlotData = "strfctn_FillXYPlotData" End Function ' ********************************************************* 'Public Sub fctn_RefreshPlot() Public Function strfctn_RefreshPlot() ' Force a redraw XYPlot.Invalidate() XYPlot.Refresh() strfctn_RefreshPlot = "strfctn_RefreshPlot is done" End Function ' ########################################################### ' ########################################################### ' ************************************************************************************ Private Sub btn_RefreshPlot_Click(sender As System.Object, e As System.EventArgs) Handles btn_RefreshPlot.Click 'Call fctn_RefreshPlot() str_FunctionReply = strfctn_RefreshPlot() End Sub End Class ' (Form_XY_Curves)