?
Solved

Convert VB.Net code snippet to C#

Posted on 2011-02-20
2
Medium Priority
?
1,144 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
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)…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 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