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

Help with managed C++/.NET/windows form viewer

Hello, all...

I am attempting to write a managed c++ dll that will open a crystal
report in the windows form viewer. For various reasons, I need to be
able to write this in C++ w/MFC as opposed to C#. The code below is
called when the user doubleclicks an entry in a tree control. The
first time the user doubleclicks this entry, the code below works
wonderfully. However, the second time the user doubleclicks, the
windows form viewer flashes the report on the screen for a split
second, then disappears. It appears that the code below works fine on
the odd-numbered invocations, but the even numbered invocations act as
described (i.e. the code below works every other attempt, but on the
attempts when it doesn't work the viewer flashes on the screen for a
split second). Also, it seems like the destructor never gets called
(perhaps this is a symptom of the problem???) I have never worked
much with managed code or .NET, so any advice or help would be
appreciated.

Thanks,
Dean
__gc class ViewForm : public System::Windows::Forms::Form
{
private:
CrystalDecisions::Windows::Forms::CrystalReportVie wer
*crystalReportViewer1;
ReportDocument *crReportDocument;
public:
ViewForm()
{
MessageBox(NULL, "CONSTRUCTOR", "TEST", MB_OK);
InitForm() ;
}
~ViewForm()
{
MessageBox(NULL, "DESTRUCTOR", "TEST", MB_OK);
Dispose() ;
}
void InitForm()
{
#pragma push_macro("new")
#undef new
crystalReportViewer1 = new
CrystalDecisions::Windows::Forms::CrystalReportVie wer();
#pragma pop_macro("new")
crystalReportViewer1->ActiveViewIndex = -1;
crystalReportViewer1->Dock =
System::Windows::Forms::DockStyle::Fill;
crystalReportViewer1->Name = "crystalReportViewer1";
crystalReportViewer1->TabIndex = 0;
Controls->Add (crystalReportViewer1);
WindowState =
System::Windows::Forms::FormWindowState::Maximized ;
Load += new System::EventHandler (this, ViewForm_Load);
}
void ViewForm_Load(System::Object* sender, System::EventArgs* e)
{
#pragma push_macro("new")
#undef new
crReportDocument = new ReportDocument();
#pragma pop_macro("new")
crReportDocument->Load("C:\\Reports\\test.rpt");
crystalReportViewer1->ReportSource = crReportDocument;
}
};

extern void EXPORT testReportViewer()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
Application::Run(new ViewForm());
}
Nov 16 '05 #1
4 2334
Hi Dean,

Thanks for your post. Please refer to the following sample which
demonstrates opening a crystal report in the windows form viewer.
C++ .NET Windows Application - Accessing Subreport
http://support.crystaldecisions.com/...s/cppnet_win_s
ubreport_basic.exe.asp

The following article lists more .NET Crystal Report sample in C++ .NET.
Crystal Reports: Listing of .NET Sample Applications in C# and C++ .NET
http://support.crystaldecisions.com/...s/apps_net.pdf

In addition, please be noted that "Microsoft supports setup and
installation for the Crystal Reports products that are included with Visual
Studio .NET. All other support is provided by Crystal Decisions."
(described in the KB article 317789 below). So I recommend you contact
Crystal Decisions to check whether there is any known issue on their side.

INFO: Licensing and Support for Crystal Reports for Visual Studio .NET
http://support.microsoft.com/?id=317789

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #2
Hello Dean,

Did the information I posted last time help you resolve the problem?

I look forward to your response.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #3
Tian,

Thanks for responding to the original message. The site you posted
did not help me much, but I did find a solution through other means.
I was attempting to open my class with Application::Run, but instead I
should have used the ShowDialog() method. Now my application works
great!

Thanks again,
Dean
Nov 16 '05 #4
Hello Dean,

I am very glad to hear that you have resolved the problem! :-)

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Nov 16 '05 #5

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

Similar topics

2
by: Lars Grøtteland | last post by:
Hello! Could anyone help me please. I tried the following - I created an application in .NET 2003. The project is a MFC Application a CDialog. I ran the application fine. I changed the...
2
by: Andrew S. Giles | last post by:
OK, Ive run my head into this wall for too long. I need help. I am developing an applicaiton in C# to present a user with a GUI to specify a configurable list of machines that he wants to listen...
18
by: MuZZy | last post by:
Hi, I got a situation here :) an dwonder if someone can help me. I have an MDI app and say, the child form has a button, clicking on which calls a database transaction - grabbing a lot of tables...
1
by: Dean Poling | last post by:
Hi, all... I posted this in the Crystal Decisions user forums with no solution, so here goes: I have created a managed c++ dll that contains a crystal reports viewer constructed with the...
4
by: nick | last post by:
hi I'm tryin to write a program that keeps track of the contents of the clipboard to a textbox, but i keep getting "An unhandled exception of type 'System.NullReferenceException' occurred in...
10
by: Sylvain Audet | last post by:
Hello! We have a Windows application that is using Crystal Reports reports containing Barcode fonts. Those reports are called through reflection into a Crystal Report Viewer and we need to have...
3
by: Adriano | last post by:
Hello, when I try to print something, either DataGrid or from Crystal Report viever the folowing error message appears and cancels printing: Object reference not set to an instance of an...
3
by: Adam Clauss | last post by:
We have a Windows service written in C#. As of late, it has started crashing after running for as little as 2 minutes. I have a handler for AppDomain.UnhandledException which does NOT get called...
1
by: bh | last post by:
I have a vb.net 2003 front-end, which is a crystal report (8.5) viewer/generator. When trying to export the crystal report to excel spreadsheets, today, which has always been successful, up until...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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.