Results 1 to 2 of 2

Thread: [RESOLVED] Microsoft ReportViewer Problem. Please help

  1. #1

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Resolved [RESOLVED] Microsoft ReportViewer Problem. Please help

    I have a problem.

    Everything works perfectly, but on the drillthrough event. Say I clicked on the cell that contains the value of "Peter".

    How can I get the clicked value of the report to a variable?


    Code:
     Public Sub DemoDrillthroughEventHandler(ByVal sender As Object, _
            ByVal e As DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
            Dim localReport As LocalReport = e.Report
            'gets the name of the repots that is loaded into the reportviewer so that
            'the wrong data wont get loaded
            If ReportViewer1.LocalReport.ReportEmbeddedResource = "Reports.rptAccount.rdlc" Then
                localReport = e.Report
                '"NewDb_orders" ---> DatabaseName_TableName
                localReport.DataSources.Add(New ReportDataSource( _
                  "Ds_InvoiceAcc", InvoiceByACC()))
                ElseIf ReportViewer1.LocalReport.ReportEmbeddedResource = "Reports.rptDetails.rdlc" Then
                   localReport = e.Report
                   localReport.DataSources.Add(New ReportDataSource( _
                   "NewDb_listings", Listings()))
            End If
        End Sub
    I need to put that value into a variable to use on other parts of my project.

  2. #2

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Re: Microsoft ReportViewer Problem. Please help

    I got it to work using drillthrough into other reports and then passing the value I needed into variables to use for other functions.

    Here is the code, just in case somebody else is having the same problem:


    vb Code:
    1. Public strFilter As String
    2.     Public strToForm As String
    3.     Public strAccNo As String
    4.  
    5.  Public Sub DemoDrillthroughEventHandler(ByVal sender As Object, _
    6.         ByVal e As DrillthroughEventArgs) Handles ReportViewer1.Drillthrough
    7.         Dim s As ReportViewer = sender
    8.         Dim sourcelocal As LocalReport = e.Report
    9.         '\\\\ Dim rp As Microsoft.Reporting.WinForms.ReportParameter = sourcelocal.OriginalParametersToDrillthrough
    10.         Dim rpc As System.Collections.Generic.IList(Of Microsoft.Reporting.WinForms.ReportParameter) = sourcelocal.OriginalParametersToDrillthrough
    11.         strFilter = (rpc(0).Values(0).ToString)
    12.         strToForm = (rpc(1).Values(0).ToString)
    13.         strAccNo = (rpc(2).Values(0).ToString)
    14.         Call CallForm(strToForm)
    15.     end sub
    16.  
    17.  Sub CallForm(ByVal strType As String)
    18.         Select Case strType
    19.             Case Is = "JNL"
    20.                 Dim f As New Journals.frmJournal
    21.                 f.InvoiceNumber = strFilter
    22.                 f.display()
    23.             Case Is = "INV"
    24.                 Dim f As New Invoice.frmInvoice
    25.                 f.InvoiceNumber = strFilter
    26.                 f.display()
    27.             Case Is = "REC"
    28.                 Dim f As New Journals.frmReceipt
    29.                 f.InvoiceNumber = strFilter
    30.                 f.display()
    31.             Case Is = "CRN"
    32.                 Dim f As New Invoice.frmCRN
    33.                 f.InvoiceNumber = strFilter
    34.                 f.display()
    35.         End Select

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width