Solved

Convert VB.Net code snippet to C#

Posted on 2011-02-20
2
1,134 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
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now