Easy implementation of report sleeve in vb/c#

Source: Internet
Author: User
Keywords: vb C # report sleeve hit

Microsoft's Crystal Report is a very good reporting tool, today I would like to talk to you if in VB 60 use Crystal Report provided by the environment in VB, please easily realize the statement of the set play function. With Crystal Report 9 as use case

Craxddrt9.dll

Craxddrt9_res_chs.dll

CRDesignerCtrl.DLL

Crdesignerctrl_res_chs.dll

The above four DLLs will exist in your system environment after you install Crystal 9. You can refer to these DLLs directly by browsing the files in the VB project

, or select "Reystal reports 9 ActiveX Designer run Time Library" in the Reference checkbox list, ""

"Reystal reports 9 ActiveX Designer design and Runtime Library"

Then add a compernent to the toolbox "Embeddedle Crystal 9 Designer Control"

After adding a Crdesignerctrl to the toolbox

OK environment has, and then we can crystal the design of the project interface embedded into our VB program.

The effect of the program is as follows:



Design



Briefly explain how to open a rpt file into the design interface

The code is as follows

[VB 6]

Private Sub Command1_Click ()
Dim F_name as String
Dim m_application as New craxddrt. Application
Dim M_report as New craxddrt. The

Reportpath = ""
Me.CommonDialog1.ShowOpen
Reportpath = Me.CommonDialog1.FileName
If reportpath <> "" Then
Set M_report = m_application.openreport (reportpath, 0)
Me.CRDesignerCtrl1.ReportObject = M_report
End If
End Sub

CRDESIGNERCTRL1 for the report design control that we added earlier.

[C #]

Craxddrt. Application m_application = new CRAXDDRT. ApplicationClass ();
Craxddrt. The M_report;
This.openFileDialog1.ShowDialog ();
F_name=this.openfiledialog1.filename.tostring ();

M_report=m_application.openreport (f_name,0);
This.axcrdesignerctrl1.reportobject=m_report;
This.axcrdesignerctrl1.displayfieldview=false;

#结束



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.