Solved

Convert VB.Net code snippet to C#

Posted on 2011-02-20
2
1,139 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 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

861 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