|
-
Mar 15th, 2010, 06:26 AM
#1
Thread Starter
Addicted Member
[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.
-
Mar 24th, 2010, 06:34 AM
#2
Thread Starter
Addicted Member
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:
Public strFilter As String Public strToForm As String Public strAccNo As String Public Sub DemoDrillthroughEventHandler(ByVal sender As Object, _ ByVal e As DrillthroughEventArgs) Handles ReportViewer1.Drillthrough Dim s As ReportViewer = sender Dim sourcelocal As LocalReport = e.Report '\\\\ Dim rp As Microsoft.Reporting.WinForms.ReportParameter = sourcelocal.OriginalParametersToDrillthrough Dim rpc As System.Collections.Generic.IList(Of Microsoft.Reporting.WinForms.ReportParameter) = sourcelocal.OriginalParametersToDrillthrough strFilter = (rpc(0).Values(0).ToString) strToForm = (rpc(1).Values(0).ToString) strAccNo = (rpc(2).Values(0).ToString) Call CallForm(strToForm) end sub Sub CallForm(ByVal strType As String) Select Case strType Case Is = "JNL" Dim f As New Journals.frmJournal f.InvoiceNumber = strFilter f.display() Case Is = "INV" Dim f As New Invoice.frmInvoice f.InvoiceNumber = strFilter f.display() Case Is = "REC" Dim f As New Journals.frmReceipt f.InvoiceNumber = strFilter f.display() Case Is = "CRN" Dim f As New Invoice.frmCRN f.InvoiceNumber = strFilter f.display() 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|