Why is This Undefined?

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I am trying to create a Sub in a VS 2005 project but the parameter being
passed comes up with an error of "Undefined" within the sub? I am including
the Sub header and the point of the error. I am lost as to why this fails?


Wayne


====================== Code Snippets ==============
Public Sub SetupRecap(ByRef recaptype As
CrystalDecisions.CrystalReports.Engine.ReportDocument)

.......................

crReport = New recaptype '<=== recaptype is flagged as undefined?

.......................

End Sub
 
Wayne,

recaptype is a variable, an instance of the type
CrystalDecisions.CrystalReports.Engine.ReportDocument. If recaptype is
instantiated when it is passed to SetupRecap, you can simpyl use it as is,
i.e. recaptype.xxxxProperty = ""
 
Carsten;

Thanks for that information. You are right in that when I removed the "New"
the error msg went away. I just can't seem to get OO right!

Wayne
 
Wayne,

You don't even need the "crReport = recaptype", just use recaptype as you
would use crReport. You simple have two variables poiting to the same
object, if not.
 
Carsten;

Thanks for the additional information. I assign that to crReport as that is
the common report name used in my preview routine. I have several processes
that populate various reports and they all end up calling the preview form
which uses a global crReport as the base.

Wayne
 
Wayne Wengert said:
I am trying to create a Sub in a VS 2005 project but the parameter being
passed comes up with an error of "Undefined" within the sub? I am including
the Sub header and the point of the error. I am lost as to why this fails?

====================== Code Snippets ==============
Public Sub SetupRecap(ByRef recaptype As
CrystalDecisions.CrystalReports.Engine.ReportDocument)

......................

crReport = New recaptype '<=== recaptype is flagged as
undefined?

If you want to make 'crReport' reference the same object as 'recaptype':

\\\
crReport = recaptype
///

'recaptype' is a variable and thus cannot be used as a type in the scenario
you describe above.

If you want to create a new instance of 'ReportDocument':

\\\
crRepoirt = New CrystalDecisions.CrystalReports.Engine.ReportDocument(...)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top