I have another Crystal question, sorry.
I have a CrystalReportsViewer wrapped in a user control. I exposed a property of type CrystalDecisions.CrystalReports.Engine.ReportDocument which I assign to the ReportSource property of the viewer.
In my form I instantiate a new instance of my user control and a ReportDocument. I use the Load() method to load my rpt then assign my user control's ReportSource property to my ReportDocument. Works great.
In order to automate my ODBC login I created a public method in my user control (addLogOnInfo(input logOn as CrystalDecisions.Shared.TableLogOnInfo)) and inside the method I call CrystalReportViewer1:LogOnInfo:Add(logOn). I create a new instance of TableLogOnInfo in the form and set the ConnectionInfo:UserID and ConnectionInfo:Password properties and send that object along in my method call. I don't have any syntax errors and all of the samples that I have found so far say this is correct but I get the following error:
Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not Unknown).
Any ideas? It looks logical to me but maybe I'm missing something obvious here.
I have no experience with the Crystal viewer controls, but some suggestions:
Do you execute this somewhere in the constructor before InitializeComponents() is executed? Then the reference to CrystalReportViewer1 would not be valid.
2nd: What does VALID-OBJECT(CrystalReportViewer1:LogOnInfo) return?
I create a new instance of TableLogOnInfo in the form and set the
ConnectionInfo:UserID and ConnectionInfo:Password
Is ConnectionInfo a VALID-OBJECT?
The first approach needs to be identify the line, that is failing. Either with MESSAGE Statements or the Debugger.
Do you execute this somewhere in the constructor
before InitializeComponents() is executed? Then the
reference to CrystalReportViewer1 would not be valid.
2nd: What does
VALID-OBJECT(CrystalReportViewer1:LogOnInfo) return?
I create a new instance of TableLogOnInfo in the
form and set the
ConnectionInfo:UserID and ConnectionInfo:Password
Is ConnectionInfo a VALID-OBJECT?
Ok, nothing before InitializeComponents().
#2 was what I needed. I had tested one object and didn't think to check CrystalReportViewer1:LogOnInfo. That was it. I forgot to instantiate it.
InitializeComponents().
CrystalReportViewer1:LogOnInfo = new CrystalDecisions.Shared.TableLogOnInfos().
That last statement instantiates the LogOnInfo collection. It's hard to add a new item to a collection without having the collection available. I feel pretty silly now.