Solved

Pass 3 Parameters to crystal report from form TextBoxes

Posted on 2009-07-15
8
988 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
  • 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 69

Expert Comment

by:Éric Moreau
ID: 24859703
0
 
LVL 69

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
 
LVL 1

Author Comment

by:H-SC
ID: 24859897
mSharfi,

The parameters work great
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 69

Expert Comment

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

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now