Question:
Rewrite Visual Basic code to C#?
Kyle
2007-05-08 00:25:23 UTC
Below is the code I need rewrote to C#. I'm writing a C# application in Visual Studio 2005. I need a code for a button where it exports a Crystal Report to PDF. I just can't find the code in C#, so I figured someone could help write this Visual Basic cod in C#. Any help would be greatly appreciated!!! Thanks

CrDiskFileDestinationOptions = New DiskFileDestinationOptions()
CrDiskFileDestinationOptions.DiskFileName = “C:\exported.pdf”
CrExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
CrReportDocument.Export()
MessageBox.Show (“Report Exported”)
Three answers:
Stuckart
2007-05-08 00:38:13 UTC
CrDiskFileDestinationOptions = new DiskFileDestinationOptions();

CrDiskFileDestinationOptions.DiskFileName = "C:\\exported.pdf";

CrExportOptions = crReportDocument.ExportOptions;

crExportOptions.DestinationOptions = crDiskFileDestinationOptions;

crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

CrReportDocument.Export();

MessageBox.Show("Report Exported");



you have to highlight over the ...'s that show up to see the finishing of certain lines. good luck!
Smutty
2007-05-08 08:26:06 UTC
CrDiskFileDestinationOptions = new DiskFileDestinationOptions();



CrDiskFileDestinationOptions.d.. = "C:\exported.pdf";





crExportOptions. DestinationOptions = crDiskFileDestinationOptions ;

crExportOptions .ExportDestinationType = ExportDestinationType .DiskFile ;

crExportOptions. ExportFormatType = ExportFormatType .PortableDocFo.. ;



CrReportDocument. Export();

MessageBox .Show (“Report Exported”);



hope that helps.
?
2016-10-15 06:04:03 UTC
you ought to construct the C progrm as a standalone software, then from VB fork yet another proces to run it, marshall the parameters it desires the two on the command line or stdin, then study its output. or you ought to construct the C area as a library and link it on your VB software and get in touch with applications in it straight away (uncertain if microsoft's compiler device can try this; I gave up toy languages like VB an prolonged time in the past, yet .internet can likely do it)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...