Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1112
  • Last Modified:

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??
0
H-SC
Asked:
H-SC
  • 4
  • 3
1 Solution
 
Mohed SharfiCommented:
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
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!

 
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now