Hi,
The following code snippet gets a report name and absolute filepath from a
datagrid and displays it the Crystal Report Viewer object on the form.
HTH
CrystalDecisions.Shared.TableLogOnInfo t;
t = new CrystalDecisions.Shared.TableLogOnInfo();
t.ConnectionInfo.UserID = "MyUser";
t.ConnectionInfo.Password = "MyPassword";
string sReportFile = mstrReportPath +
dgReports.SelectedRows[0].Cells[1].Value.ToString();//Full path
string sReport = dgReports.SelectedRows[0].Cells[1].Value.ToString();
ReportDocument r;
CrystalReportParameters.ICrystalParameters c = new
CrystalReportParameters.clsMain() ;
r = c.DisplayParameters(sReport, sReportFile);
if(r!=null)
{
crv.LogOnInfo = new CrystalDecisions.Shared.TableLogOnInfos();//crv is the
CrystalReportViewer object
crv.LogOnInfo.Add(t);
crv.ReportSource = r;
}
"Bob" <Go****@Yahoo.Comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
I have a regular C# form with a button on it. I want to click the
button and open the report.
What code do I need to open the report?
Thanks-in-advance.
Bob