Solved

Pass 3 Parameters to crystal report from form TextBoxes

Posted on 2009-07-15
8
1,034 Views
Last Modified: 2012-05-07
I have a form with 3 TextBoxes unbound.  The user will enter all of the data in those 3 boxes.  When a button is clicked I would like to pass those three into parameters that I have already set-up in my crystal report and then print the report without preview.  How can this be done??
0
Comment
Question by:H-SC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 7

Accepted Solution

by:
Mohed Sharfi earned 500 total points
ID: 24859607
Hi H-SC,
How are you
please try this code
thanks
 Dim rpt As New rpt_Name
                rpt.SetDataSource(ds)
                rpt.SetParameterValue("Computer_Name", My.Computer.Name)
                rpt.SetParameterValue("User_Name", User_Full_Name)
                Dim objViewer As New Reports_Viewer
                With objViewer
                    .CrystalReportViewer.ReportSource = rpt
                    .Show()
                End With
            Catch ex As Exception
                MsgBox(ex.ToString)
            Finally
                Me.Cursor = Cursors.Default
            End Try

Open in new window

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24859703
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24859732
and to be able to print without the preview screen, you can call the PrintToPrinter method of the ReportDocument object.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:H-SC
ID: 24859897
mSharfi,

The parameters work great
0
 
LVL 1

Author Comment

by:H-SC
ID: 24859912
emoreau,

Many thanks for the suggestions as well.  I have had your site bookmarked for quite some time.  A great site.
0
 
LVL 1

Author Comment

by:H-SC
ID: 24859953
one more thought...

in the PrintToPrinter  can I pass a numeric updown value for the number of copies to print?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24860034
yes you can
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24860316
I thought I would have received some points for the PrintToPrinter! Too bad.
0

Featured Post

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.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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