I have what should be a simple problem to fix.
I am trying to insert an initial line (0) into a datagridview (named params). The program will then read each cell in that row, pass them through a function and return values be placed into the next line (1). This will continue until one of the parameters reaches some set point.
The problem that I am having is that when I try to insert a new line, it appears above the initial one and not below it like I would like it to.
Here's my code so far:
Code:
Private Sub HurricaneWinds_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim init_xrange() As Double = New Double() {0.0, 0.0, 0.0, 40.0, 0.0}
For i As Integer = 0 To 4
params(i, 0).Value = init_xrange(i)
Next
Dim xx(4) As Double
For j As Integer = 1 To 10
Dim prange() As Double = New Double() {CDbl(DragCo.Text.Trim), CDbl(WindVelCoef.Text.Trim), CDbl(WindVelExp.Text.Trim), CDbl(Gravity.Text.Trim)}
Dim xrange() As Double = New Double() {CDbl(params(0, j - 1).Value), CDbl(params(1, j - 1).Value), CDbl(params(2, j - 1).Value), CDbl(params(3, j - 1).Value), CDbl(params(4, j - 1).Value)}
xx = rk4(CInt(NumTimesteps.Text.Trim), CDbl(TimeStep.Text.Trim), xrange, prange)
Dim item As New DataGridViewRow
item.CreateCells(params)
With item
.Cells(0).Value = xx(0)
.Cells(1).Value = xx(1)
.Cells(2).Value = xx(2)
.Cells(3).Value = xx(3)
.Cells(4).Value = xx(4)
End With
params.Rows.Add(item)
Next
End Sub
And a picture of the problem:
Any suggestions?
Thanks