?
Solved

Report from Vb.net Windows Form

Posted on 2006-06-01
10
Medium Priority
?
624 Views
Last Modified: 2012-06-27
What is the best way to get all records from a filtered windows form BindingSource to Crystal Reports?
0
Comment
Question by:davidrichardson
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 16808478
0
 
LVL 7

Author Comment

by:davidrichardson
ID: 16812238
Hi, i can create the report linked to the datadet no problem however i need to apply a filter
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 16812247
create a clone of your dataset, delete rows from datatable and call the acceptchanges. finally, bind your report to this new filtered dataset
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 7

Author Comment

by:davidrichardson
ID: 16812278
Tried this but get no results


        Dim reportPath As String = Application.StartupPath & "\" & "RptOrders.rpt"
        Dim cr As New CrystalDecisions.CrystalReports.Engine.ReportDocument

        Dim newDS As New DataSet '= CtrOrders.DsOrders.Clone()
        Dim newtbl As New DataTable

        Dim oTempTable As DataTable = CtrOrders.DsOrders.Tables("tbloutstandingorders")
        Dim foundRows() As DataRow
        Dim getRow As DataRow
        Dim strFilter = "account like '" & TxbSearch.Text & "%'"
        foundRows = oTempTable.Select(strFilter)

        For Each getRow In foundRows
            newtbl.ImportRow(getRow)
        Next

        newDS.Tables.Add(newtbl)
        newDS.AcceptChanges()

        cr.Load(reportPath)
        cr.SetDataSource(newtbl)
        Dim rpt As New FrmReport
        rpt.CrystalReportViewer1.ReportSource = cr
        rpt.Show()

Can you spot anything obvious? (getting late now will have another look in the morning)

Thanks

Dave
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 16812649
do you have results if you pass dsorders to your report?

0
 
LVL 7

Author Comment

by:davidrichardson
ID: 16813995
no
0
 
LVL 7

Author Comment

by:davidrichardson
ID: 16815027
Sorted it,

        Dim reportPath As String = Application.StartupPath & "\" & "RptOrders.rpt"
        Dim cr As New CrystalDecisions.CrystalReports.Engine.ReportDocument

        Dim newDS As DataSet = CtrOrders.DsOrders.Clone()
        Dim oTempTable As DataTable = CtrOrders.DsOrders.Tables("mytable")
        Dim foundRows() As DataRow
        Dim getRow As DataRow

        Dim strFilter = "account like '" & TxbFilter.Text & "'"
        foundRows = oTempTable.Select(strFilter)

        For Each getRow In foundRows
            newDS.Tables("mytable").ImportRow(getRow)
        Next

        cr.Load(reportPath)
        cr.SetDataSource(newDS)
        Dim rpt As New FrmReport
        rpt.CrystalReportViewer1.ReportSource = cr
        rpt.Show()


Thanks
0
 

Expert Comment

by:--TripWire--
ID: 34219744
Hello,

I can't get my code to allow me past this part....

Dim rpt As New FrmReport
        rpt.CrystalReportViewer1.ReportSource = cr
        rpt.Show()

can someone please explain what FrmReport is?  It will not allow me to auto-complete.

Thanks
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 34220355
--TripWire--:
You might consider opening your own question.

FrmReport is probably the vb name for the DSR that generates the report.

mlmcc
0
 

Expert Comment

by:--TripWire--
ID: 34223401
what's dsr?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

864 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