.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> VB.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to set parameters of crystal reports in vb.net

Posted By: Raymond     Posted Date: May 27, 2011    Points:5   Category :VB.Net
Dear all,

I am using below code. But find it does not work??

Dim rd As New ReportDocument
rd.Load(Path + "\Reports\StockTakeException.rpt")
rd.SetDataSource(ds)
rd.SetParameterValue("Printed By", printedby)
rd.SetParameterValue("frmLoc", fromLoc)
rd.SetParameterValue("toLoc", toLoc)

rd.Refresh()

rd.PrintOptions.PrinterName = LaserPrinter
rd.PrintToPrinter(1, False, 0, 0) // throw exception here : Missing Parameters



Responses
Author: Sunil Yadav       [Moderator]      
Posted Date: May 27, 2011     Points: 20   
Author: Ravi Ranjan Kumar             
Posted Date: May 30, 2011     Points: 20   

Try to get PrinterName properly as
Dim instance As PrinterSettings
Dim value As String
value = instance.PrinterName
instance.PrinterName = value
and then try to pass this value as
rd.PrintOptions.PrinterName = LaserPrinter


and to pass Crystal Report Parameters Programmatically take a look at given link
http://www.c-sharpcorner.com/UploadFile/mahesh/paramInCR11012006132839PM/paramInCR.aspx

Thanks & Regards
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend