Hello, here is my code:
I have a chart, and a data grid. The data in the grid is shown on the chart. I have two UpAndDownNumerical inputs that control the beginning and ending points of the chart. When I change those values I want the datagrid to remove the data that does not fall within that range. This code works up until the While loop, when the program inexplicably stops running, it just freezes. No error message.
Guesses?
Ryan
Code:
If loading = 1 Then 'if the program is loadin data, stop the subroutine
Exit Sub
End If
Dim currentvalue As Decimal
currentvalue = UpperBound.Value + 0.5
If currentvalue <= LowerBound.Value Then
UpperBound.Value = currentvalue
Else
ExportChart.ChartAreas(0).AxisX.Maximum = UpperBound.Value
End If
Dim c As Integer
c = ExportDataGrid.RowCount
Dim row As Integer = 1
While row < c
If MainForm.DataGrid.Rows(row).Cells(1).Value > LowerBound.Value Then
If MainForm.DataGrid.Rows(row).Cells(1).Value < UpperBound.Value Then
ExportDataGrid.Rows(row).Cells(0).Value = MainForm.DataGrid.Rows(row).Cells(1).Value
ExportDataGrid.Rows(row).Cells(1).Value = MainForm.DataGrid.Rows(row).Cells(2).Value
ExportDataGrid.Rows(row).Cells(2).Value = MainForm.DataGrid.Rows(row).Cells(3).Value
row = row + 1
Else
ExportDataGrid.Rows(row).Cells(0).Value = 0
ExportDataGrid.Rows(row).Cells(1).Value = 0
ExportDataGrid.Rows(row).Cells(2).Value = 0
End If
Else
ExportDataGrid.Rows(row).Cells(0).Value = 0
ExportDataGrid.Rows(row).Cells(1).Value = 0
ExportDataGrid.Rows(row).Cells(2).Value = 0
End If
End WhileGuesses?
Ryan