I'm creating a crystal report in Visual Studio 2012 but I keep getting an error of
an unhandled exception of type 'system.stackoverflowexception' occurred in system.windows.forms.dll
Here my code for Form 4:
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
private void Form4_Load(object sender, EventArgs e)
{
CrystalReport1 r = new CrystalReport1();
maintenance_productDataSetTableAdapters.COLOR_TYPETableAdapter ta = new EBL.maintenance_productDataSetTableAdapters.COLOR_TYPETableAdapter();
maintenance_productDataSet.COLOR_TYPEDataTable table = ta.GetData();
r.SetDataSource(table.DefaultView);
crystalReportViewer1.ReportSource = r;
crystalReportViewer1.Refresh();
}
}
Form4 the one load when I start to run the VS 2012.
I also tried to use DataSet but it has the same error. Code with DataSet:
CrystalReport1 rep = new CrystalReport1();
DataSet1TableAdapters.COLOR_TYPETableAdapter ta = new Weeak.DataSet1TableAdapters.COLOR_TYPETableAdapter();
DataSet1.COLOR_TYPEDataTable table = ta.GetData();
rep.SetDataSource(table.DefaultView);
crystalReportViewer1.ReportSource = rep;
crystalReportViewer1.Refresh();
Because Crystal Report was developed using an earlier version of the .NET Framework, you need to add these lines to your app.config
file:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>