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();
}