Solved

Pass 3 Parameters to crystal report from form TextBoxes

Posted on 2009-07-15
8
1,006 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 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
Gigs: Get Your Project Delivered by an Expert

Select from 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.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with solving error related to resources file 4 47
rebind a grid after user clicks on node in treeview 1 34
vb.net help 4 29
Footer for each row on Gridview 2 21
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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