Click here to Skip to main content
15,887,867 members

Comments by PmJN (Top 1 by date)

PmJN 24-Sep-19 7:24am View    
Hi Maciej,

Thanks for your input. I tried to convert my datagridview data to Datatable using but still can not achieve what i want.

here is how i tried to convert my datagridView data to a Datatable.

private void chdata()
{
DataTable dt = new DataTable();
foreach (GridColumn column in ProdgridView.VisibleColumns)
{
dt.Columns.Add(column.FieldName, column.ColumnType);
}
for (int i = 0; i < ProdgridView.DataRowCount; i++)
{
DataRow row = dt.NewRow();
foreach (GridColumn column in ProdgridView.VisibleColumns)
{
row[column.FieldName] = ProdgridView.GetRowCellValue(i, column);
}
dt.Rows.Add(row);

ProdchartControl.DataSource = dt;
ProdchartControl.Series["ProdA"].ArgumentDataMember = "Prod_Date";
ProdchartControl.Series["ProdA"].ValueDataMembers.AddRange("AProd");
}
}

but i get the error: System.NotSupportedException: 'DataSet does not support System.Nullable<>.' when trying to use the converted datagridview to Datatable as my chart datasource.

Any suggestion would be appreciated.

Regards.