473,657 Members | 2,545 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(By Val strDel As String, ByVal strSQL As String,
ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecision s.CrystalReport s.Engine.Report Document =
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 954
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(By Val strDel As String, ByVal strSQL As String,
ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecision s.CrystalReport s.Engine.Report Document =
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******** *****@TK2MSFTNG P14.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(By Val strDel As String, ByVal strSQL As
String, ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecision s.CrystalReport s.Engine.Report Document =
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. StandardStateme nt
This relates to StandardStateme nt.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 CrystalDecision s.CrystalReport s.Engine.Report Document =
StandardStateme nt

I previously used

Dim myReport As StandardStateme nt

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******** *****@TK2MSFTNG P14.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(By Val strDel As String, ByVal strSQL As
String, ByVal strSelect As String, ByVal ReportName As Object) As Integer

Dim myReport As CrystalDecision s.CrystalReport s.Engine.Report Document =
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. StandardStateme nt
This relates to StandardStateme nt.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 CrystalDecision s.CrystalReport s.Engine.Report Document =
StandardStateme nt

I previously used

Dim myReport As StandardStateme nt

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 crReportDocumen t As New
CrystalDecision s.CrystalReport s.Engine.Report Document()

crReportDocumen t.Load(ReportNa me)

Hope this helps
Chris
Feb 9 '06 #4

"Chris" <no@spam.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Chubbly Geezer wrote:
"Chris" <no@spam.com> wrote in message
news:Ow******** *****@TK2MSFTNG P14.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(By Val strDel As String, ByVal strSQL As
String, ByVal strSelect As String, ByVal ReportName As Object) As
Integer

Dim myReport As CrystalDecision s.CrystalReport s.Engine.Report Document =
ReportNam e

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.
StandardStateme nt
This relates to StandardStateme nt.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 CrystalDecision s.CrystalReport s.Engine.Report Document =
StandardStateme nt

I previously used

Dim myReport As StandardStateme nt

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 crReportDocumen t As New
CrystalDecision s.CrystalReport s.Engine.Report Document()

crReportDocumen t.Load(ReportNa me)

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******** ********@TK2MSF TNGP14.phx.gbl. ..
Chubbly Geezer wrote:
"Chris" <no@spam.com> wrote in message
news:Ow***** ********@TK2MSF TNGP14.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(By Val strDel As String, ByVal strSQL As
>String, ByVal strSelect As String, ByVal ReportName As Object) As
>Integer
>
>Dim myReport As CrystalDecision s.CrystalReport s.Engine.Report Document =
>ReportNa me
>
>
>
>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.
StandardStat ement
This relates to StandardStateme nt.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 CrystalDecision s.CrystalReport s.Engine.Report Document =
StandardStat ement

I previously used

Dim myReport As StandardStateme nt

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 crReportDocumen t As New
CrystalDecisi ons.CrystalRepo rts.Engine.Repo rtDocument()

crReportDocum ent.Load(Report Name)

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
3086
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, piece types, squares, etc.). To accomplish this, I used implicit conversions. For instance, a color used to be: typedef int Color; // and a few constants... Now a color is (paraphrased):
5
3029
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 templatized conversion operator defined as follows:
7
3256
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 I couldn't find the exact rule in the C++ standard. And what if the classes have template parameters? It would be great if somebody could get me a rough hint where in the
26
3799
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 lead to a lot of use of the database and the adding of quite a lot of new data (though I can't conceive of them adding more than than 10s of thousands of records, which won't change the current performance profile at all). If there is a SQL...
31
6618
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 variable becomes 364 and the other one becomes 365. Does anyone have any insight to what the problem is? Thanks in advance. Bjørn
4
6482
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? Thanks in advance... -Nikhil
2
6865
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 static explicit System.IntPtr (long);
47
2852
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 used and why ? Thanx
1
2162
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 char*:" << str << '\n'; } void print(int x)
21
2442
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 type is not a single identifier or keyword. Which one is correct? For example: unsigned long x = unsigned long(y); REH
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7324
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1953
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.