473,320 Members | 2,000 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Crystal Reports

Dear NG,

I am just learning object orientated programing in general and C# in
particular.
My first real project is an inventory application using a SQL database. I
have
an item master editor working fine now and it is time to write some paper
reports
from data stored in SQL. I decided to give Crystal Reports a try.

By using the Wizard I have CrystalReport1.rpt sitting as a tab in my
project.
The book that I bought, Using Crystal Reports 10, gives an example in VB:

Dim Report As New ReportDocument
Report.Load("C:\My Reports\Sales.rpt")

What is the equivalent C# execution? I assume that I am going to need a
using statement. The VB Dim statement is probably the C# instantiation.
If I am going to have a path in C# I am probably going to need
double \\ as in: "C:\\My Reports\\Sales.rpt" Am I on the right track or
way off base?

Thinking now about this issue on a higher level, is Crystal Reports the best
way to go? I am an old dude and can code COBOL style reports from scratch.
What about generating text files and just printing them. What is the
procedure
for loading a general Windows printing object? Since reports are likely to
be long, I wish not to display the report on the screen, but generate the
report to a file and then have the user go to the File menu and select
Print File to begin this process.

In this posting I am looking for both direction and some specific C#
statements.

Thanks in advance,

Bob

Robert Schuldenfrei
bo*@s-i-inc.com
Nov 16 '05 #1
7 7609

hi,

don't compare syntatical resemblence. I will explain what is happening
over here.

that vb.net code block try to load a report file to reportdocument object.

I will explaine how it happening in C#.

First you have to riht click your project folder to add an
CrystalReport1.rpt file.
Once you add this .rpt file to your solution it will give a wizard that will
help you out to set the table or dataset(tables).

After successful completion of this (that is adding one .rpt file) you have
to use
crystalReportViewer1 to view the report. This much thing you can achive by
using the .NET IDE or programmatically.
Nov 16 '05 #2
Hi Sreejith,

Thank you for the information. I am having a little trouble understanding
your answer. Here is my current status:

1/ I have the CrystalReport1.rpt file in my solution.
2/ Unsuccessful in using the CrystalReportViewer as it is "grayed out" in
the Toolbox under Web Forms.
3/ Can not call anything from my code to execute the report. I would think
that there should be a namespace for CR objects and there might be an object
containing a method for viewing the report.
4/ Is CR the best way to write reports?

Cheers,

Bob

Robert Schuldenfrei
bo*@s-i-inc.com

"Sreejith S S Nair" <Sr************@discussions.microsoft.com> wrote in
message news:B0**********************************@microsof t.com...

hi,

don't compare syntatical resemblence. I will explain what is happening
over here.

that vb.net code block try to load a report file to reportdocument object.

I will explaine how it happening in C#.

First you have to riht click your project folder to add an
CrystalReport1.rpt file.
Once you add this .rpt file to your solution it will give a wizard that will help you out to set the table or dataset(tables).

After successful completion of this (that is adding one .rpt file) you have to use
crystalReportViewer1 to view the report. This much thing you can achive by
using the .NET IDE or programmatically.

Nov 16 '05 #3
Hi Robert,

take a look at http://www.crystalreportsbook.com/Default.asp it's a FREE
book about using CR with .net

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Robert Schuldenfrei" <bo*@s-i-inc.com> wrote in message
news:ljKQc.217950$IQ4.217278@attbi_s02...
Dear NG,

I am just learning object orientated programing in general and C# in
particular.
My first real project is an inventory application using a SQL database. I
have
an item master editor working fine now and it is time to write some paper
reports
from data stored in SQL. I decided to give Crystal Reports a try.

By using the Wizard I have CrystalReport1.rpt sitting as a tab in my
project.
The book that I bought, Using Crystal Reports 10, gives an example in VB:

Dim Report As New ReportDocument
Report.Load("C:\My Reports\Sales.rpt")

What is the equivalent C# execution? I assume that I am going to need a
using statement. The VB Dim statement is probably the C# instantiation.
If I am going to have a path in C# I am probably going to need
double \\ as in: "C:\\My Reports\\Sales.rpt" Am I on the right track or
way off base?

Thinking now about this issue on a higher level, is Crystal Reports the best way to go? I am an old dude and can code COBOL style reports from scratch. What about generating text files and just printing them. What is the
procedure
for loading a general Windows printing object? Since reports are likely to be long, I wish not to display the report on the screen, but generate the
report to a file and then have the user go to the File menu and select
Print File to begin this process.

In this posting I am looking for both direction and some specific C#
statements.

Thanks in advance,

Bob

Robert Schuldenfrei
bo*@s-i-inc.com

Nov 16 '05 #4
Hi again robert,

in addition to the link I sent you I want to let you know that you dont have
to load a report in the code, by default CR create a class derived from
ReportDocument named like your report, you just create an instance of this
report.

Dim Report As New ReportDocument
Report.Load("C:\My Reports\Sales.rpt")

What is the equivalent C# execution? I assume that I am going to need a
using statement. The VB Dim statement is probably the C# instantiation.
If I am going to have a path in C# I am probably going to need
double \\ as in: "C:\\My Reports\\Sales.rpt" Am I on the right track or
way off base?

Thinking now about this issue on a higher level, is Crystal Reports the best way to go? I am an old dude and can code COBOL style reports from scratch. What about generating text files and just printing them. What is the
procedure


CR is the way to ge with no doubt, especially in win apps. learn it and it
will make your work a lot more easy.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Nov 16 '05 #5
To reply to the part the others did not:

"Robert Schuldenfrei" wrote:
Dim Report As New ReportDocument
Report.Load("C:\My Reports\Sales.rpt")

What is the equivalent C# execution?


ReportDocument Report = new ReportDocument();
Report.Load("C:\\My Reports\\Sales.rpt");

Note: Dim Report As NewReportDocument would not work in VB.NET. Anytime you
call a constructor you need open and close parenthesis, even for the default
constructor.

Some good resources for C#:
http://www.c-sharpcorner.com
http://msdn.microsoft.com

Tons of other sites are available, just go to http://www.google.com and type
in C# + .net and you'll get a few thousand results. If you're serious about
learning C# I suggest getting a book to reference.

HTH
Nov 16 '05 #6
Dear NG,

Thanks for all of your help. I got my first CR report to execute. I now
have to sit down and learn this system. Here is the code that did it:

private void btnCrystal_Click(object sender, System.EventArgs e)
{
ReportDocument report = new ReportDocument();

report.Load("C:\\database\\MCS-3-SQL\\MCS-3inC#\\ItemMaster\\ItemMaster\\Cry
stalReport1.rpt");

report.ExportToDisk(CrystalDecisions.Shared.Export FormatType.RichText,"C:\\t
mp\\CrystalOut.rtf");
MessageBox.Show("Crystal");
}

Cheers,

Bob

"Robert Schuldenfrei" <bo*@s-i-inc.com> wrote in message
news:ljKQc.217950$IQ4.217278@attbi_s02...
Dear NG,

I am just learning object orientated programing in general and C# in
particular.
My first real project is an inventory application using a SQL database. I
have
an item master editor working fine now and it is time to write some paper
reports
from data stored in SQL. I decided to give Crystal Reports a try.

By using the Wizard I have CrystalReport1.rpt sitting as a tab in my
project.
The book that I bought, Using Crystal Reports 10, gives an example in VB:

Dim Report As New ReportDocument
Report.Load("C:\My Reports\Sales.rpt")

What is the equivalent C# execution? I assume that I am going to need a
using statement. The VB Dim statement is probably the C# instantiation.
If I am going to have a path in C# I am probably going to need
double \\ as in: "C:\\My Reports\\Sales.rpt" Am I on the right track or
way off base?

Thinking now about this issue on a higher level, is Crystal Reports the best way to go? I am an old dude and can code COBOL style reports from scratch. What about generating text files and just printing them. What is the
procedure
for loading a general Windows printing object? Since reports are likely to be long, I wish not to display the report on the screen, but generate the
report to a file and then have the user go to the File menu and select
Print File to begin this process.

In this posting I am looking for both direction and some specific C#
statements.

Thanks in advance,

Bob

Robert Schuldenfrei
bo*@s-i-inc.com

Nov 16 '05 #7
Hi,

ReportDocument Report = new ReportDocument();
Report.Load("C:\\My Reports\\Sales.rpt");


I strongly recommend not to use this construction, unless that the report
change dynamically, you would have to deal with an extra file on your
instalation as well as make sure that the path is correct,etc

It's MUCH safer to use the class that is created by the CR designer.
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Nov 16 '05 #8

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

Similar topics

1
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal...
5
by: BStorm | last post by:
I have a transaction log file where the DataSet table's Description column is actually delimited into "subcolumns" based upon the transaction id. I would like to parse these into separate fields...
3
by: Gheaci Maschl | last post by:
Hi all! I would like to have your opinion about my problem and my proposal how to solve it: Ingredients: - BTriev database - Crystal Reports - maybe MS Access - Liinos6 (small ERP software)
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
0
by: Robert Warnestam | last post by:
Hello, I have some problems deploying Crystal Reports. I'm using Visual Studio 2005 Beta 1. In this version Crystal Reports (9.7.3500.0) is included. I created a small test application...
3
by: VMI | last post by:
I know this may not be the best NG for this, but I feel you guys know more about this than any of the other NGs. I need to build several simple reports (over 50 of them and they get their data...
1
by: Lyners | last post by:
Hello all, I have created an ASP.NET website that uses Crystal Reports that works on the localhost (my PC), but when I copy it to the server it does not. The problem is...
2
by: =?Utf-8?B?Um9zcyBNYXNvbg==?= | last post by:
Hi I am interested in using crystal reports for the first time but have a few questions that someone maybe able to help with before I get started. The background to my query is that a client is...
3
by: Miro | last post by:
Hi, Just wondering what a good book is on visual studios 2008 ( or 2005 if no 2008 ) that teaches you how to properly use crystal reports with it. Or im assuming that as long as I can create a...
1
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.