To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Article :: Building Dynamic Systems with Expressions in .NET
How Is XML Like An Interface?
Understanding Covariance and Contravariance
Print VS 2010 Keyboard Shortcut References in Letter (8.5x11in) and A4 (210×297mm) Sizes
Updated Productivity Power Tools



Go Back   VBForums > Visual Basic > Reporting (Crystal, Access and Data Designer)

Reply Post New Thread
 
Thread Tools Display Modes
Old Mar 15th, 2010, 06:26 AM   #1
tgf-47
Lively Member
 
tgf-47's Avatar
 
Join Date: Feb 10
Location: CapeTown, South Africa -34.01244,18.337415
Posts: 115
tgf-47 is an unknown quantity at this point (<10)
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.
tgf-47 is offline   Reply With Quote
Old Mar 24th, 2010, 06:34 AM   #2
tgf-47
Lively Member
 
tgf-47's Avatar
 
Join Date: Feb 10
Location: CapeTown, South Africa -34.01244,18.337415
Posts: 115
tgf-47 is an unknown quantity at this point (<10)
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
tgf-47 is offline   Reply With Quote
Reply

Tags
reports, vb 2008

Go Back   VBForums > Visual Basic > Reporting (Crystal, Access and Data Designer)


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:04 PM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.