Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

Subroutine causes program to stall?

$
0
0
Hello, here is my code:
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 While

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

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>