some advice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

this is a repost because the more i thought about it the more i think i
posted in wrong area, please forgive me if redundant post. anyway:

i have a single function i'm working on;

If var=a
dim oCr as reportType1
elseif
dim oCr as reportType2
endi if

oCr.Export

I'm getting the squiggly under oCr.Export saying not defined. What is a good
way to resolve this?

thanks,
rodchar
 
You are defining oCr inside an If block, which isn't visible outside the
If block.

I don't know what the rest of your code looks like so I'm not sure, but
this may work.

dim oCr as Object
If var=a
oCr = ctype(MyReportName,reportType1)
elseif
oCr = ctype(MyReportName,reportType2)
endi if

oCr.Export
 
rodchar said:
hey all,

this is a repost because the more i thought about it the more i
think i posted in wrong area, please forgive me if redundant post.
anyway:

i have a single function i'm working on;

If var=a
dim oCr as reportType1
elseif
dim oCr as reportType2
endi if

oCr.Export

I'm getting the squiggly under oCr.Export saying not defined. What
is a good way to resolve this?


dim oCr as CrystalDecisions.CrystalReports.Engine.ReportDocument

If var=a
oCr = reportType1 'pseudo-code: assign the report object here
elseif
oCr = reportType2
endi if

oCr.Export


Armin
 
Terry Olsen said:
You are defining oCr inside an If block, which isn't visible outside
the If block.

I don't know what the rest of your code looks like so I'm not sure,
but this may work.

dim oCr as Object
If var=a
oCr = ctype(MyReportName,reportType1)
elseif
oCr = ctype(MyReportName,reportType2)
endi if

oCr.Export


The type Object does not have a method 'Export'. This doesn't compile.


Armin
 
Unless you have Option Strict Off, which unfortunately many do. Of course
there would be no point of doing the CType then.
 
Terry Olsen said:
You are defining oCr inside an If block, which isn't visible outside the
If block.
True.

I don't know what the rest of your code looks like so I'm not sure, but
this may work.

dim oCr as Object
If var=a
oCr = ctype(MyReportName,reportType1)

The cast is not necessary because 'Object' is the super type of any type.
 
rodchar said:
this is a repost because the more i thought about it the more i think i
posted in wrong area, please forgive me if redundant post. anyway:

i have a single function i'm working on;

If var=a
dim oCr as reportType1
elseif
dim oCr as reportType2
endi if

oCr.Export

I'm getting the squiggly under oCr.Export saying not defined. What is a
good
way to resolve this?

If 'ReportType1' and 'ReportType2' have a common base type which defines the
'Export' method, you can use something like this:

\\\
Dim cr As Report
If var = a Then
cr = New ReportType1()
Else
cr = New ReportType2()
End If
cr.Export()
///
 
Herfried,
The cast is not necessary because 'Object' is the super type of any type.
Have a look at the answer from Armin.

Is that is the fact than your answer from yesterday about the html.control
was completely wrong. (While it was not in my opinion).



Cor
 
Cor Ligthert said:
Have a look at the answer from Armin.

Is that is the fact than your answer from yesterday about the html.control
was completely wrong. (While it was not in my opinion).

Huh?! 'Object' is the super type of any type, but 'HtmlControl' is not the
super type of 'WebControl' or any of its derived types.
 
Herfried,
Huh?! 'Object' is the super type of any type, but 'HtmlControl' is not
the super type of 'WebControl' or any of its derived types.
Not the super type, that is object, however Webcontrol it is the base for
the htmlcontrol. See my message in that thread to Armin (I was suprissed as
well).

Cor
 
Cor Ligthert said:
Not the super type, that is object, however Webcontrol it is the base for
the htmlcontrol. See my message in that thread to Armin (I was suprissed
as well).

That's wrong. Both, 'WebControl' and 'HtmlControl' inherit from
'System.Web.UI.Control', but neither one is the base type of the other one.
 
Herfried,
That's wrong. Both, 'WebControl' and 'HtmlControl' inherit from
'System.Web.UI.Control', but neither one is the base type of the other
one.
Whatever but both don't have the member 'item' and that is for me what Armin
is correct in.

Object does as well not have all items from its derived classes.

Cor
 

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