crystal reports - Trying to use crystalreportviewer to display .rpt's using vb.net -
i've been trying build simple vb.net app displays built .rpt reports in crystalreportviewer. no matter how many times try code it, run problems. reports have worked, others have thrown errors such load report failed, invalid path, etc.. of reports work when run them in crystal.
ideally, i'm looking have menu report names, , crystalreportviewer user can click report, , app prompts them parameter values.
i'm working crystal 9 believe, , vs.net 2003, or have access 2005 well.
can me this, or explain why i'm running problems? nothing has been consistent - i'm @ loss right now.
help highly appreciated!! in advance
you need them working in development environment, on client side, make sure dependent files installed , network drive names mapped consistently if code's dependent on it.
here's example in vb.net 2005:
public class frmcrystal public sub _init(byval windowtitle string, byval rptpath string) dim rptdoc crystaldecisions.crystalreports.engine.reportdocument dim coninfo crystaldecisions.shared.tablelogoninfo dim crtables crystaldecisions.crystalreports.engine.tables dim crtable crystaldecisions.crystalreports.engine.table me.text = windowtitle rptdoc = new crystaldecisions.crystalreports.engine.reportdocument rptdoc.load(rptpath) coninfo = new crystaldecisions.shared.tablelogoninfo crtables = rptdoc.database.tables each crtable in crtables coninfo.connectioninfo .servername = "dhsdev10069\dsd" .databasename = "dsdworkplantracking" .integratedsecurity = true end coninfo.reportname = rptpath crtable.applylogoninfo(coninfo) next rptcrystal.reportsource = rptdoc end sub
the form frmcrystal contains 1 crystalreportviewer control:
private sub initializecomponent() me.rptcrystal = new crystaldecisions.windows.forms.crystalreportviewer me.suspendlayout() ' 'rptcrystal ' me.rptcrystal.activeviewindex = -1 me.rptcrystal.borderstyle = system.windows.forms.borderstyle.fixedsingle me.rptcrystal.displaygrouptree = false me.rptcrystal.dock = system.windows.forms.dockstyle.fill me.rptcrystal.location = new system.drawing.point(0, 0) me.rptcrystal.name = "rptcrystal" me.rptcrystal.size = new system.drawing.size(292, 273) me.rptcrystal.tabindex = 0 ' 'frmcrystal ' me.autoscaledimensions = new system.drawing.sizef(6.0!, 13.0!) me.autoscalemode = system.windows.forms.autoscalemode.font me.clientsize = new system.drawing.size(292, 273) me.controls.add(me.rptcrystal) me.name = "frmcrystal" me.text = "dsd report" me.resumelayout(false) end sub end class
then call form, need like:
private _crystal frmcrystal _crystal = new frmcrystal _crystal.mdiparent = me _crystal._init(windowtitle, rptpath) _crystal.windowstate = formwindowstate.maximized _crystal.show()
Comments
Post a Comment