vb.net - Passing Crystal Report name as parameter -
i using function calling crystal report :
showreport ( report1)
in show report showreport :
dim repdoc new report1 **' here want assign crytalreport name** repdoc.setdatabaselogon("username", "*****") crystalreportviewer1.reportsource = repdoc crystalreportviewer1.visible = true how can ?
i have done in past may able use purposes. normaly use dropdown list or listbox allow user select file want view , use pass item index the intfileid.
private sub opencr(byval intfileid integer) dim areport reportdocument select case intfileid case 0 : areport = new countsheets case 1 : areport = new categoryvariance case 2 : areport = new dollarvariance case 3 : areport = new categoryvarianceadmin case 4 : areport = new dollarvarianceadmin case 5 : areport = new physicalcount case 6 : areport = new booktophysicalcount case 7 : areport = new missingitemcodes end select areport.refresh() areport.setparametervalue("isamtsshown", isamtsshown) areport.setparametervalue("parstoreid", storeid) areport.setdatabaselogon("username", "password", "server", "table") crvreports.reportsource = areport end sub to answer specific question passing name argument. this:
private sub runreportbyname() ' crystal report name in ' project myreport.rpt dim areport reportdocument = new myreport opencr(areport) end sub private sub opencr(byval repdoc reportdocument) 'repdoc.setdatabaselogon("","","","") crystalreportviewer1.reportsource = repdoc crystalreportviewer1.visible = true end sub
Comments
Post a Comment