?
Solved

Convert VB.Net code snippet to C#

Posted on 2011-02-20
2
Medium Priority
?
1,150 Views
Last Modified: 2013-12-17
Need to write this VB.net code snippet in C#.  All it does is generate a SSRS report in the report viewer control.  Will also need to know what references are needed.  Thanks!
Private Sub Display_Report(ByVal strReportServerURL, ByVal strReportPath As String)

        'Clear
        lblError.Text = ""

        'Make the report viewer invisible for now
        rvLMS.Visible = False

        Try
            'Turn on the parameter prompts
            rvLMS.ShowParameterPrompts = True

            'Set the report Processing Mode
            rvLMS.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote

            'Set the Report Viewer - Server URL & Report Path
            rvLMS.ServerReport.ReportServerUrl = New Uri(strReportServerURL)
            rvLMS.ServerReport.ReportPath = strReportPath

            rvLMS.Visible = True

        Catch ex As Exception
            lblError.Text = "Error: " & ex.Message & " Stack Trace: " & ex.StackTrace
        End Try

    End Sub

Open in new window

0
Comment
Question by:MariaHalt
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 2000 total points
ID: 34938321
It should be something like this:

private void Display_Report(string strReportServerURL, string strReportPath)
{
        // Clear
        lblError.Text = "";

        // Make the report viewer invisible for now
        rvLMS.Visible = false;

        try
        {
            // Turn on the parameter prompts
            rvLMS.ShowParameterPrompts = true;

            // Set the report Processing Mode
            rvLMS.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

            // Set the Report Viewer - Server URL & Report Path
            rvLMS.ServerReport.ReportServerUrl = new Uri(strReportServerURL);
            rvLMS.ServerReport.ReportPath = strReportPath;

            rvLMS.Visible = true;
        }
        catch(Exception e)
        {
            lblError.Text = "Error: " + ex.Message + " Stack Trace: " + ex.StackTrace;
        }
}

Open in new window

0
 

Author Closing Comment

by:MariaHalt
ID: 34938581
Thanks!
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question