0

This is the error

so I have made windows form with the code below to generate a barcode label everything was ok when running the app inside MS Visual Studio but when I create a setup file for my app and install it there was an error when I want to show the crystal report. Why this error and how can I fix it?

public partial class Form1 : Form

{
   

    DataTable dt;
    ReportDocument cry = new ReportDocument();
    public Form1()
    {
        InitializeComponent();
       

}


    private void textBox2_TextChanged(object sender, EventArgs e)
    {

    }

    private void Form1_Load(object sender, EventArgs e)
    {
        dt = new DataTable();
        dt.TableName = "DataTable1";
        dt.Columns.Add("Product", typeof(string));
        dt.Columns.Add("Price", typeof(string));
        dt.Columns.Add("Company Name", typeof(string));
        dt.Columns.Add("Barcode", typeof(string));
        dataGridView1.DataSource = dt;

    }

    private void btn_barcode_Click(object sender, EventArgs e)
    {
        {
            int Endcount = Convert.ToInt32(tb_loop.Text);
            for (int i = 1; i <= Endcount; i++)
            {
                dt.Rows.Add(cb_product.Text, tb_price.Text + " IQD", tb_cname.Text, tb_enterbarcode.Text);
               
            }
        }



    }

    private void button1_Click(object sender, EventArgs e)
    {
        cb_product.Text = "";
        tb_price.Text = "";
        tb_enterbarcode.Text = "";
        tb_loop.Text = "";
    }

    private void button2_Click(object sender, EventArgs e)
    {
        cry.Load("CrystalReport1.rpt");
        cry.SetDataSource(dt);
        crystalReportViewer1.ReportSource = cry;
    }

    private void exitbtn_Click(object sender, EventArgs e)
    {
        this.Close();
  
    }
  • You must include the exception details, the picture does not provide enough info. – iSR5 Sep 11 '21 at 20:19
  • you can check the error details i have edited the post thanks – Abdullah Muthanna Sep 11 '21 at 21:15
  • Ensure you have installed the correct Crystal Report runtime version on your machine. – iSR5 Sep 11 '21 at 21:16
  • how can i check it ? – Abdullah Muthanna Sep 11 '21 at 21:42
  • From your Windows, Go to your Control Panel > Add Remove Programs, and then search for the crystal report runtime, it should be there, and it should be either 64-bit or 32-bit, with the same version of the project references. – iSR5 Sep 11 '21 at 21:44
  • I have SAP Crystal Reports runtime engine for .NET Framework (64bit) – Abdullah Muthanna Sep 11 '21 at 21:48
  • this might help https://stackoverflow.com/questions/10833894/a-document-processed-by-the-jrc-engine-cannot-be-opened-in-the-c-stack – iSR5 Sep 11 '21 at 21:52
  • Well actually now if i try to run crystal report there is an error An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll Additional information: Could not load file or assembly 'CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified. – Abdullah Muthanna Sep 11 '21 at 22:14
  • Make sure `CystalDecisions.Web` is referenced in your project. – iSR5 Sep 11 '21 at 23:05
  • Still have same problem as i mentioned in the post – Abdullah Muthanna Sep 12 '21 at 05:25

0 Answers0