473,386 Members | 1,647 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,386 software developers and data experts.

Open Crystal Report

Bob
I have a regular C# form with a button on it. I want to click the
button and open the report.

What code do I need to open the report?

Thanks-in-advance.

Bob

Oct 12 '06 #1
2 2471
Bob
Hi,
The following code snippet gets a report name and absolute filepath from a
datagrid and displays it the Crystal Report Viewer object on the form.
HTH
CrystalDecisions.Shared.TableLogOnInfo t;

t = new CrystalDecisions.Shared.TableLogOnInfo();
t.ConnectionInfo.UserID = "MyUser";

t.ConnectionInfo.Password = "MyPassword";

string sReportFile = mstrReportPath +
dgReports.SelectedRows[0].Cells[1].Value.ToString();//Full path

string sReport = dgReports.SelectedRows[0].Cells[1].Value.ToString();
ReportDocument r;

CrystalReportParameters.ICrystalParameters c = new
CrystalReportParameters.clsMain() ;

r = c.DisplayParameters(sReport, sReportFile);

if(r!=null)

{

crv.LogOnInfo = new CrystalDecisions.Shared.TableLogOnInfos();//crv is the
CrystalReportViewer object

crv.LogOnInfo.Add(t);

crv.ReportSource = r;

}

"Bob" <Go****@Yahoo.Comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
I have a regular C# form with a button on it. I want to click the
button and open the report.

What code do I need to open the report?

Thanks-in-advance.

Bob

Oct 13 '06 #2
Bob

All I want is the code that runs on the on_click event of my command
button...I already have the report..


Bob wrote:
Hi,
The following code snippet gets a report name and absolute filepath from a
datagrid and displays it the Crystal Report Viewer object on the form.
HTH
CrystalDecisions.Shared.TableLogOnInfo t;

t = new CrystalDecisions.Shared.TableLogOnInfo();
t.ConnectionInfo.UserID = "MyUser";

t.ConnectionInfo.Password = "MyPassword";

string sReportFile = mstrReportPath +
dgReports.SelectedRows[0].Cells[1].Value.ToString();//Full path

string sReport = dgReports.SelectedRows[0].Cells[1].Value.ToString();
ReportDocument r;

CrystalReportParameters.ICrystalParameters c = new
CrystalReportParameters.clsMain() ;

r = c.DisplayParameters(sReport, sReportFile);

if(r!=null)

{

crv.LogOnInfo = new CrystalDecisions.Shared.TableLogOnInfos();//crv is the
CrystalReportViewer object

crv.LogOnInfo.Add(t);

crv.ReportSource = r;

}

"Bob" <Go****@Yahoo.Comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
I have a regular C# form with a button on it. I want to click the
button and open the report.

What code do I need to open the report?

Thanks-in-advance.

Bob
Oct 13 '06 #3

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...
0
by: V.Boomessh | last post by:
Hai all I am creating an VB.NET application which has some reporting involved. i use Crystal report for VS.NET to create the report I have designed the report(rpt file) by making a connection...
1
by: Jason Huang | last post by:
Hi, Would someone tell me how to open a CrystalReport in my ASP.Net C#? We can use the Show method to open a windows form, but what method should we use for opening a CrystalReport? Thanks for...
2
by: project | last post by:
I want to print an sales invoice with out open crystal report. I want to know ,with out opening Crystal report, how can I give the command to be printing invoice. I'm using the following lines...
0
by: edward zhang | last post by:
I have a VB.Net application which uses the Crystal Report(Crystal Report 8.5) Viewer to open reports. One of the reports uses a stored procedure and another one uses tables as data resource, both...
0
by: neeraj | last post by:
Hi people's I developed One Windows application with some crystal Report I used my predefined crystal reports files for my application. I just take one crystal report viewer on form and set...
2
by: mike11d11 | last post by:
I created this test project and published it. I then tried installing it on another machine and it installs fine. but when I go to open the crystalreportviewer to show my created report I get an...
0
by: hemu4hemang | last post by:
Hi Friends I m working on one application in Vb.net and Sql server and crystal report 9.0. This application works fine and all reports are open...
0
by: Prasanta | last post by:
Hello, In my system the crystal report working till yesterday as well, but from today whenever I tried to open crystal report its asking me to log on to crystal management server, which never...
2
by: Prasanta | last post by:
Hello, In my system the crystal report working till yesterday as well, but from today whenever I tried to open crystal report its asking me to log on to crystal management server, which never...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.