I am making a project in C# .Net. I am new to C# as well as Crystal reports.
I have made a form having "View" button and some combo Boxes, date time picker on it.
On clicking the View button, I want a new form to open having only crystal report viewer on it.
So, I made a new form by adding new item->Windows Form.
CrystalReportViewer crystalReportViewer1;
CrystalReport1 objRpt;
Ds = new DataSet1();
cnn = new OleDbConnection(connString);
OleDbCommand command = new OleDbCommand(query, cnn);
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
cnn.Open();
command.Parameters.Add("?", OleDbType.VarChar).Value = date_from;
command.Parameters.Add("?", OleDbType.VarChar).Value = date_to;
adapter.Fill(Ds, "DataTable1");
objRpt.SetDataSource(Ds);
crystalReportViewer1.ReportSource = objRpt; --> Error
But when I try to access crystalReportViewer on form1, it gives error since it is from form2.
If I want to access variables from form1 on form2, what should be done?
So, can anybody help me to solve this problem?