473,503 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Conversion question

Now I've done this before but can't remember how.

I want to pass a string into a procedure and then use that string in a Dim
statement.

i.e.

Public Function PrintReports(ByVal strDel As String, ByVal strSQL As String,
ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
ReportName

But I am getting a conversion error in that I cannot convert a string to
this object type.

Any ideas please.?

Chubbly
Feb 9 '06 #1
5 949
Chubbly Geezer wrote:
Now I've done this before but can't remember how.

I want to pass a string into a procedure and then use that string in a Dim
statement.

i.e.

Public Function PrintReports(ByVal strDel As String, ByVal strSQL As String,
ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
ReportName

But I am getting a conversion error in that I cannot convert a string to
this object type.

Any ideas please.?

Chubbly


You can not convert a string to a ReportDocument. Now in your function
you are passing an object. What type is this object you are passing in.
Where is your Report stored? Is it a file or an embedded resource?

Chris
Feb 9 '06 #2

"Chris" <no@spam.com> wrote in message
news:Ow*************@TK2MSFTNGP14.phx.gbl...
Chubbly Geezer wrote:
Now I've done this before but can't remember how.

I want to pass a string into a procedure and then use that string in a
Dim statement.

i.e.

Public Function PrintReports(ByVal strDel As String, ByVal strSQL As
String, ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
ReportName

But I am getting a conversion error in that I cannot convert a string to
this object type.

Any ideas please.?

Chubbly


You can not convert a string to a ReportDocument. Now in your function
you are passing an object. What type is this object you are passing in.
Where is your Report stored? Is it a file or an embedded resource?

Chris


I am passing in a string (was initially declared as a string) which equates
to the report name of rhe report that I want to run. i.e. StandardStatement
This relates to StandardStatement.rpt which is a crystal report which has
been created and resides in my VB 2005 app.

I realise that I can not convert a string to a ReportDocument but do not
know how to use the strings value the way I want.

I am trying to execute a line as below:

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
StandardStatement

I previously used

Dim myReport As StandardStatement

but now find I need to pass in the report name.

Thanks

Chubbly
Feb 9 '06 #3
Chubbly Geezer wrote:
"Chris" <no@spam.com> wrote in message
news:Ow*************@TK2MSFTNGP14.phx.gbl...
Chubbly Geezer wrote:
Now I've done this before but can't remember how.

I want to pass a string into a procedure and then use that string in a
Dim statement.

i.e.

Public Function PrintReports(ByVal strDel As String, ByVal strSQL As
String, ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
ReportName

But I am getting a conversion error in that I cannot convert a string to
this object type.

Any ideas please.?

Chubbly


You can not convert a string to a ReportDocument. Now in your function
you are passing an object. What type is this object you are passing in.
Where is your Report stored? Is it a file or an embedded resource?

Chris

I am passing in a string (was initially declared as a string) which equates
to the report name of rhe report that I want to run. i.e. StandardStatement
This relates to StandardStatement.rpt which is a crystal report which has
been created and resides in my VB 2005 app.

I realise that I can not convert a string to a ReportDocument but do not
know how to use the strings value the way I want.

I am trying to execute a line as below:

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
StandardStatement

I previously used

Dim myReport As StandardStatement

but now find I need to pass in the report name.

Thanks

Chubbly


If the string is the report name then you are going about this wrong.

There are two ways I know of to load a report.

1. Get it out of an embedded resource
2. Load it from a file

How I do #2 is:

Dim crReportDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocum ent()

crReportDocument.Load(ReportName)

Hope this helps
Chris
Feb 9 '06 #4

"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Chubbly Geezer wrote:
"Chris" <no@spam.com> wrote in message
news:Ow*************@TK2MSFTNGP14.phx.gbl...
Chubbly Geezer wrote:

Now I've done this before but can't remember how.

I want to pass a string into a procedure and then use that string in a
Dim statement.

i.e.

Public Function PrintReports(ByVal strDel As String, ByVal strSQL As
String, ByVal strSelect As String, ByVal ReportName As Object) As
Integer

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
ReportName

But I am getting a conversion error in that I cannot convert a string to
this object type.

Any ideas please.?

Chubbly

You can not convert a string to a ReportDocument. Now in your function
you are passing an object. What type is this object you are passing in.
Where is your Report stored? Is it a file or an embedded resource?

Chris

I am passing in a string (was initially declared as a string) which
equates to the report name of rhe report that I want to run. i.e.
StandardStatement
This relates to StandardStatement.rpt which is a crystal report which has
been created and resides in my VB 2005 app.

I realise that I can not convert a string to a ReportDocument but do not
know how to use the strings value the way I want.

I am trying to execute a line as below:

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
StandardStatement

I previously used

Dim myReport As StandardStatement

but now find I need to pass in the report name.

Thanks

Chubbly


If the string is the report name then you are going about this wrong.

There are two ways I know of to load a report.

1. Get it out of an embedded resource
2. Load it from a file

How I do #2 is:

Dim crReportDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocum ent()

crReportDocument.Load(ReportName)

Hope this helps
Chris


That'll load a report from a specific drive location won't it. What I was
hoping to do was just use an instance of the report without loading an
external file/report from another location.
Feb 9 '06 #5
Chubbly Geezer wrote:
"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Chubbly Geezer wrote:
"Chris" <no@spam.com> wrote in message
news:Ow*************@TK2MSFTNGP14.phx.gbl...
Chubbly Geezer wrote:
>Now I've done this before but can't remember how.
>
>I want to pass a string into a procedure and then use that string in a
>Dim statement.
>
>i.e.
>
>Public Function PrintReports(ByVal strDel As String, ByVal strSQL As
>String, ByVal strSelect As String, ByVal ReportName As Object) As
>Integer
>
>Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
>ReportName
>
>
>
>But I am getting a conversion error in that I cannot convert a string to
>this object type.
>
>Any ideas please.?
>
>
>
>Chubbly
>
>

You can not convert a string to a ReportDocument. Now in your function
you are passing an object. What type is this object you are passing in.
Where is your Report stored? Is it a file or an embedded resource?

Chris
I am passing in a string (was initially declared as a string) which
equates to the report name of rhe report that I want to run. i.e.
StandardStatement
This relates to StandardStatement.rpt which is a crystal report which has
been created and resides in my VB 2005 app.

I realise that I can not convert a string to a ReportDocument but do not
know how to use the strings value the way I want.

I am trying to execute a line as below:

Dim myReport As CrystalDecisions.CrystalReports.Engine.ReportDocum ent =
StandardStatement

I previously used

Dim myReport As StandardStatement

but now find I need to pass in the report name.

Thanks

Chubbly


If the string is the report name then you are going about this wrong.

There are two ways I know of to load a report.

1. Get it out of an embedded resource
2. Load it from a file

How I do #2 is:

Dim crReportDocument As New
CrystalDecisions.CrystalReports.Engine.ReportDoc ument()

crReportDocument.Load(ReportName)

Hope this helps
Chris

That'll load a report from a specific drive location won't it. What I was
hoping to do was just use an instance of the report without loading an
external file/report from another location.


You can do it as an embedded resource. Then you load it straight from
inside your dll. There are examples of that around and you can
reference the resouce from a string then.

Chris
Feb 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3077
by: Russell Reagan | last post by:
In a newer version of a chess program I am writing, I have created classes that are (more or less) drop in replacements for things that used to be plain old integer or enumerated variables (colors,...
5
3020
by: Vijai Kalyan | last post by:
Hello, I have come back to C++ after a couple of years with Java so I am quite rusty and this question may seem poor: My platform is Windows XP with MSVC 7.1. I have a class with a...
7
3247
by: Michael Lehn | last post by:
Hi, I have a question regarding the conversion of objects. When is the conversion done by the constructor and when by the operator. My feeling tells me that the constructor is preferred. But...
26
3774
by: David W. Fenton | last post by:
A client is panicking about their large Access application, which has been running smoothly with 100s of thousands of records for quite some time. They have a big project in the next year that will...
31
6575
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
4
6467
by: Nikhil Patel | last post by:
Hi all, I am a VB6 programmer and learning C#. I am currently reading a chapter on types. I have question regarding enums. Why do we need to convert enum members to the value that they represent?...
2
6859
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
47
2809
by: rawCoder | last post by:
Hi, Just wanted to know if there is any speed difference between VB conversion Keywords like CInt, Clng, CStr, CDbl, CBool etc. ..NETs Convert.To<...> methods. And which is better to be...
1
2156
by: hunter hou | last post by:
Hello,Please look at the following code(from C++ in a nutshell) and my questions.Thanks,***Hunter... typedef void (*strproc)(const char*); void print(const char* str) { std::cout << "const...
21
2417
by: REH | last post by:
It it permissible to use the constructor style cast with primitives such as "unsigned long"? One of my compilers accepts this syntax, the other does not. The failing one chokes on the fact that the...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.