Pass 3 Parameters to crystal report from form TextBoxes

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??
LVL 1
H-SCAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Mohed SharfiConnect With a Mentor Vice CEOCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
0
 
Éric MoreauSenior .Net ConsultantCommented:
and to be able to print without the preview screen, you can call the PrintToPrinter method of the ReportDocument object.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
H-SCAuthor Commented:
mSharfi,

The parameters work great
0
 
H-SCAuthor Commented:
emoreau,

Many thanks for the suggestions as well.  I have had your site bookmarked for quite some time.  A great site.
0
 
H-SCAuthor Commented:
one more thought...

in the PrintToPrinter  can I pass a numeric updown value for the number of copies to print?
0
 
Éric MoreauSenior .Net ConsultantCommented:
yes you can
0
 
Éric MoreauSenior .Net ConsultantCommented:
I thought I would have received some points for the PrintToPrinter! Too bad.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.