Dim dt As String = CurrentTable.Name Dim cname As String = "InsertRowTemp" If DataTables(dt).DataCols.Contains(cname) = False Then Datatables(dt).DataCols.Add(cname,GetType(Double)) Tables(dt).Cols(cname).Visible = False End If Dim ds As Integer = DataTables(dt).DataRows.Count Dim r As Integer For r = 0 To ds-1 Tables(dt).Rows(r)(cname) = r+1 Next Dim i As Integer = CurrentTable.Position If i < 0 Then CurrentTable.AddNew() ElseIf i = 0 Then Dim v As Double = CurrentTable.Current(cname) - 1 CurrentTable.AddNew()(cname) = v Else Dim v1 As Double = CurrentTable.Current(cname) Dim v2 As Double = CurrentTable.Rows(CurrentTable.Position - 1)(cname) CurrentTable.AddNew()(cname) = (v1+v2) / 2 End If CurrentTable.Sort = cname CurrentTable.Position = i
|