Here is my conundrum. I am writing a program that uses checkboxes as controls for what happens next. If you check one box, one type of query occurs. If you check the other, another TOTALLY different query is used. Since the data is so dramatically different, I want to use two different Crystals to present the data. I have ran into a snag. I use this code to determine which code is used:
if (chkSelectUserID.Checked == true)
{
CrystalReport1 crReportDocument = new CrystalReport1();
}
else
{
CrystalReport2 crReportDocument = new CrystalReport2();
}
This is all under code for a button I call cmdCreateCrystalReports. Later in the method I use this code to make the crystal reports show up:
crReportDocument.SetDataSource(dataSet);
Form2 reportViewer = new Form2(crReportDocument);
reportViewer.Refresh();
reportViewer.ShowDialog();
Since the assignment of crReportDocument happens within the if and else clauses, it's throwing an error about scope. Does anyone know a better way to do this? I don't think two buttons is a solution either. Seems like more work.
Thanks in advance.
Jami