I've been successfully using Crystal Reports 8.5 Developer and the CRViewer control with VB6 for 2 years now. I recently began to make the transition to VB.NET.
I realize that VB.NET handles COM objects differently than VB6, and expected that there might be some differences in how I would need to implement the CRViewer in .NET.
Here is an exerpt of my code (does not include variable declarations or irrelevant code):
rs.Open(strSQL, cnn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly)
CRReport = CRApp.OpenReport(strReportPath, 1)
CRReport.Database.SetDataSource(rs, 3, 1)
CRReport.ReadRecords() 'Report displays no data if I leave this line out
frm.CRViewer.ReportSource = CRReport
rs = Nothing
I've come across two major obstacles so far:
1) If I ommit the line 'CRReport.ReadRecords()', the report displays no data. If I add this line, however, the report displays data, but I can only view the first page. The viewer shows "1 of 1+" but the navigation buttons do nothing. How can I get the navigation buttons working so I can view the entire report?
2) I have all the necessary export dll's installed (I've verified this with Crystal Documentation). However, clicking on the export button does not bring up the "Choose Export Format" dialog. I eventually gave up on this (temporarily) and tried messing with the CRViewer events manually. The navigation button events still did nothing. But interestingly enough, the export button will pop up with a msgbox when i put a message box in the export button event.
Coming from VB6 where I had none of these problems, I've grown very frustrated with the changes VB.NET has introduced to what seemed like a straight-forward process. I'd appreciate any help you can give.
Thanks in Advance,