Hey,

I'm ultimately trying to create a new series for each datatable. I am trying to do it by merging the datatables creating a new series each 2 columns in the new datatable.

The only problem is I hit this error:

Series data points do not support values of type System.Data.DataRowView only values of these types can be used: Double, Decimal, Single, int, long, uint, ulong, String, DateTime, short, ushort.

every time it runs through for the second time (to add a new series).

Here is all the relevant code (I hope)

Thanks : )Code:Imports WindowsApplication2.ProjectileForm Imports System.Math Imports System.IO Imports System.Runtime.Serialization Imports System.ComponentModel Imports System.Runtime.Serialization.Formatters Public Class ProjectileForm Public calculator As New Calculate Public g As Double = 9.8 Public counteruno As Integer = 1 Public counterdos As Integer = -1 Dim chartmaximumX As Integer Public count As Integer = 0 Dim chartmaximumY As Double Dim lastmaxX As Double Dim lastmaxY As Double Dim datatable As DataTable 'new? Public dset As New DataSet Dim velocity As Double Dim angle As Double Dim ivelocityX As Double Dim ivelocityY As Double Dim roundedY As Double Dim x As Double Dim y As Double 'not all variables needed, investigate later Dim maxY As Double Dim maxX As Double Dim t As Double = 0 Dim maxT As Double Dim RoundedX As Integer Public dt As New DataTable Public firstiteration As Boolean = True Private Sub Simulate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simulate.Click calculator.Projectile(g, ivelocityX, ivelocityY, maxT, firstiteration, counteruno, counterdos) Dim NewTab As New TabPage Dim datagrids As New DataGridView Chart1.Series.Add(count) Chart1.Series(count).ChartType = DataVisualization.Charting.SeriesChartType.Spline Chart1.DataSource = dt Chart1.Series(count).XValueMember = (counteruno) Chart1.Series(count).YValueMembers = (counterdos) NewTab.Name = (count + 1) NewTab.Text = NewTab.Name datagrids.Dock = DockStyle.Fill datagrids.RowHeadersVisible = False Dim datatable As New DataTable datatable.Columns.Add("X data") datatable.Columns.Add("Y data") count += 1 Me.TabControl1.Controls.Add(NewTab) NewTab.Controls.Add(datagrids) Me.TabControl1.SelectedIndex = Me.TabControl1.TabCount - 1 'Dim series As DataVisualization.Charting.Series = New DataVisualization.Charting.Series() DataGridView1.DataSource = dt datagrids.DataSource = datatable Chart1.DataSource = dt Chart1.ChartAreas(0).AxisX.IntervalOffset = 1 lastmaxX = Round(chartmaximumX, 0) lastmaxY = Round(chartmaximumY, 0) Chart1.ChartAreas(0).AxisX.IsStartedFromZero = True Chart1.ChartAreas(0).AxisY.IsStartedFromZero = True counteruno = counteruno + 1 counterdos = counterdos - 1 End Sub Public Class Calculate Public Sub Projectile(ByVal g As Double, ByVal ivelocityX As Double, ByVal ivelocityY As Double, ByVal maxt As Double, ByVal firstiteration As Boolean, ByRef counteruno As Integer, ByRef counterdos As Integer) Dim datatable As New DataTable Dim x As Double = 0 Dim y As Double = 0 Dim t As Double = 0 datatable.Columns.Add(counteruno) datatable.Columns.Add(counterdos) Do If firstiteration = True Then Dim firstrow As DataRow = datatable.NewRow firstrow.SetField(0, 0) firstrow.SetField(1, 0) datatable.Rows.Add(firstrow) firstiteration = False Else End If t = t + (maxt / 100) x = Round(ivelocityX * t, 3) y = Round(ivelocityY * t + 0.5 * -g * (t ^ 2), 3) Dim nextRow As DataRow = datatable.NewRow Dim lastrow As DataRow = datatable.NewRow If y > 0 Then nextRow.SetField(0, x) nextRow.SetField(1, y) datatable.Rows.Add(nextRow) Else t = maxt y = 0 lastrow.SetField(0, x) lastrow.SetField(1, y) datatable.Rows.Add(lastrow) End If Loop Until t >= maxt If firstiteration = True Then ProjectileForm.dt = datatable Else ProjectileForm.dt.Merge(datatable) End If ProjectileForm.dt = datatable ProjectileForm.DataGridView1.DataSource = ProjectileForm.dt ProjectileForm.dset.Tables.Add(datatable) End Sub End Class