Michael_D
asked on
Simple report viewer VB.Net
Hello experts,
I am trying to create simple report viewer in VB.NET (VS 2003)
I put CRViewer control on the form and trying to assign .rpt file name to the ReportSource property
But it doesn't work - i get message "Load report failed."
I tried to download sample applications from BusinessObects Support site but all samples are using "build-in" reports. and I need to open .rpt file from the disk.
Please help.
I am trying to create simple report viewer in VB.NET (VS 2003)
I put CRViewer control on the form and trying to assign .rpt file name to the ReportSource property
But it doesn't work - i get message "Load report failed."
I tried to download sample applications from BusinessObects Support site but all samples are using "build-in" reports. and I need to open .rpt file from the disk.
Please help.
ASKER
ast2550,
as I said - I already downloaded that file - yes it use .rpt file but it part of the VB.net solution - kind of embeded report like a Form.
I need a sample that will open ANY given file
as I said - I already downloaded that file - yes it use .rpt file but it part of the VB.net solution - kind of embeded report like a Form.
I need a sample that will open ANY given file
What code are you using?
I don't have the .Net version but that may be a feature that is not available. Can you save rpt files from the designer? I assume you are using the version of Crystal that came with CR.Net. If not then which version of Crystal?
mlmcc
I don't have the .Net version but that may be a feature that is not available. Can you save rpt files from the designer? I assume you are using the version of Crystal that came with CR.Net. If not then which version of Crystal?
mlmcc
ASKER
The reports are designed in CR10 (not .NET). The viewer that I am trying to create should be installed on client computers without CR installed. This might be problem by itself. but I cant make it work on my developer machine with CR 10 Pro installed
The code I am using is simple
I have a form with CRViewer control on it.
When user choose File->Open from menu I show standart Open File dialog and assign the resulting filename to ReportSource Property of CRViewer
Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.Click
Dim FileName As String
If dlgOpenReport.ShowDialog = DialogResult.OK Then
FileName = dlgOpenReport.FileName
Try
CR.ReportSource = FileName
Catch ex As Exception
MsgBox("Cannot open file: " & FileName & ControlChars.CrLf & "Exception: " & ex.Message)
End Try
End If
End Sub
It doesn't throw exception. It show regular message box stating "Load report failed".
BTW I tried to open empty report (template with static text only) and it works!!!
Maybe it database conectivity problem?
The template also have one table and it asks for username and password as expected.
The database is Oracle 10g (through ODBC) if it make a difference
The code I am using is simple
I have a form with CRViewer control on it.
When user choose File->Open from menu I show standart Open File dialog and assign the resulting filename to ReportSource Property of CRViewer
Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.Click
Dim FileName As String
If dlgOpenReport.ShowDialog = DialogResult.OK Then
FileName = dlgOpenReport.FileName
Try
CR.ReportSource = FileName
Catch ex As Exception
MsgBox("Cannot open file: " & FileName & ControlChars.CrLf & "Exception: " & ex.Message)
End Try
End If
End Sub
It doesn't throw exception. It show regular message box stating "Load report failed".
BTW I tried to open empty report (template with static text only) and it works!!!
Maybe it database conectivity problem?
The template also have one table and it asks for username and password as expected.
The database is Oracle 10g (through ODBC) if it make a difference
Here's some sample code to view an external rpt in the viewer (crv1) on a Windows form in VB.Net (using VS 2002). Also a routine to login to the report (assumes SQL Server).
Imports CrystalDecisions.CrystalRe ports.Engi ne
Imports CrystalDecisions.Shared
Private Sub frmReportEngine_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
crReportDocument.Load("C:\ Replace with Your Report Path and Name.rpt", OpenReportMethod.OpenRepor tByTempCop y)
Call LogonReport(crReportDocume nt)
crv1.ReportSource = crReportDocument
Public Sub LogonReport(ByVal rptReport As CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument, ByVal strLocation As String)
Dim strServer As String = ""
Dim strDBase As String = ""
Dim strUID As String = ""
Dim strPWD As String = ""
Dim crReportDocument As New ReportDocument()
Dim crTableLogonInfos As New TableLogOnInfos()
Dim crTableLogonInfo As New TableLogOnInfo()
Dim crTables As Tables
Dim crTable As Table
Dim crSections As Sections
Dim crSection As Section
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
Dim crDataBase As Database
Dim crConnInfo As New ConnectionInfo()
Dim subRepDoc As New ReportDocument()
strServer = YourServer
strDBase = YourDatabase
strUID = YourUserID
strPWD = YourPassword
'Logs into the tables in the report
crReportDocument = rptReport
crDataBase = crReportDocument.Database
crTables = crDataBase.Tables
For Each crTable In crTables
With crConnInfo
.ServerName = strServer
.DatabaseName = strDBase
.UserID = strUID
.Password = strPWD
End With
'MsgBox("REPORT - TableName = " & crTable.Name & "", MsgBoxStyle.OKOnly)
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.Connectio nInfo = crConnInfo
crTable.ApplyLogOnInfo(crT ableLogonI nfo)
crTable.Location = strDBase & ".dbo." & crTable.Name
crTable.ApplyLogOnInfo(crT ableLogonI nfo)
Next
'Logs into the tables in the Sub-reports
crSections = crReportDocument.ReportDef inition.Se ctions
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.Subreport Object Then
crSubreportObject = CType(crReportObject, SubreportObject)
subRepDoc = crSubreportObject.OpenSubr eport(crSu breportObj ect.Subrep ortName)
crDataBase = subRepDoc.Database
crTables = crDataBase.Tables
For Each crTable In crTables
With crConnInfo
.ServerName = strServer
.DatabaseName = strDBase
.UserID = strUID
.Password = strPWD
End With
'MsgBox("SUBREPORT - TableName = " & crTable.Name & "", MsgBoxStyle.OKOnly)
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.Connectio nInfo = crConnInfo
crTable.ApplyLogOnInfo(crT ableLogonI nfo)
crTable.Location = strDBase & ".dbo." & crTable.Name
Next
End If
Next
Next
End Sub
Imports CrystalDecisions.CrystalRe
Imports CrystalDecisions.Shared
Private Sub frmReportEngine_Load(ByVal
crReportDocument.Load("C:\
Call LogonReport(crReportDocume
crv1.ReportSource = crReportDocument
Public Sub LogonReport(ByVal rptReport As CrystalDecisions.CrystalRe
Dim strServer As String = ""
Dim strDBase As String = ""
Dim strUID As String = ""
Dim strPWD As String = ""
Dim crReportDocument As New ReportDocument()
Dim crTableLogonInfos As New TableLogOnInfos()
Dim crTableLogonInfo As New TableLogOnInfo()
Dim crTables As Tables
Dim crTable As Table
Dim crSections As Sections
Dim crSection As Section
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
Dim crDataBase As Database
Dim crConnInfo As New ConnectionInfo()
Dim subRepDoc As New ReportDocument()
strServer = YourServer
strDBase = YourDatabase
strUID = YourUserID
strPWD = YourPassword
'Logs into the tables in the report
crReportDocument = rptReport
crDataBase = crReportDocument.Database
crTables = crDataBase.Tables
For Each crTable In crTables
With crConnInfo
.ServerName = strServer
.DatabaseName = strDBase
.UserID = strUID
.Password = strPWD
End With
'MsgBox("REPORT - TableName = " & crTable.Name & "", MsgBoxStyle.OKOnly)
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.Connectio
crTable.ApplyLogOnInfo(crT
crTable.Location = strDBase & ".dbo." & crTable.Name
crTable.ApplyLogOnInfo(crT
Next
'Logs into the tables in the Sub-reports
crSections = crReportDocument.ReportDef
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.Subreport
crSubreportObject = CType(crReportObject, SubreportObject)
subRepDoc = crSubreportObject.OpenSubr
crDataBase = subRepDoc.Database
crTables = crDataBase.Tables
For Each crTable In crTables
With crConnInfo
.ServerName = strServer
.DatabaseName = strDBase
.UserID = strUID
.Password = strPWD
End With
'MsgBox("SUBREPORT - TableName = " & crTable.Name & "", MsgBoxStyle.OKOnly)
crTableLogonInfo = crTable.LogOnInfo
crTableLogonInfo.Connectio
crTable.ApplyLogOnInfo(crT
crTable.Location = strDBase & ".dbo." & crTable.Name
Next
End If
Next
Next
End Sub
ASKER
Hi janmarini, thank you for posting.
Same thing here:
Private Sub frmReportEngine_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
crReportDocument.Load("C:\ Replace with Your Report Path and Name.rpt", OpenReportMethod.OpenRepor tByTempCop y) '<---- Throw exception "Load report failed"
Call LogonReport(crReportDocume nt)
crv1.ReportSource = crReportDocument
.....
Same thing here:
Private Sub frmReportEngine_Load(ByVal
crReportDocument.Load("C:\
Call LogonReport(crReportDocume
crv1.ReportSource = crReportDocument
.....
Does the rpt file exist in the specified location?
Can you view the same report in Crystal?
Do you have approprite permissions to the directory?
Check for typos in the report name or path.
Can you view the same report in Crystal?
Do you have approprite permissions to the directory?
Check for typos in the report name or path.
ASKER
Does the rpt file exist in the specified location? >>> YES
Can you view the same report in Crystal? >>> YES
Do you have approprite permissions to the directory? >>> YES It is local hard drive not network location
Check for typos in the report name or path. >>> I am not typing the name - I am choosing it using Open File Dialog
Also it not one but all .rpt files have the issue exept very simple template (see my previous post)
Can you view the same report in Crystal? >>> YES
Do you have approprite permissions to the directory? >>> YES It is local hard drive not network location
Check for typos in the report name or path. >>> I am not typing the name - I am choosing it using Open File Dialog
Also it not one but all .rpt files have the issue exept very simple template (see my previous post)
Have you tried testing opening your report by hard-coding your report location? Your problem might be with your Open file diaplog - have you verified that it passes the proper report *PATH* and filename (FileName = dlgOpenReport.FileName)?
ASKER
janmarini,
I do verify the file name - it is correct, fully qualified filename (with a path and extention).
I do verify the file name - it is correct, fully qualified filename (with a path and extention).
ASKER
OK I think I understand what is the problem:
When I tried to add one of the reports to my solution it says that it was created with CR version later than installed.
So actually I am trying to open CR10 report with CR.net (which is I believe compatable with CR9).
Is there a solution for this problem?
I cannot upgrate Visual Studio to higher version so don't suggest. Also we are planing to upgrade CR to XI - we need some new features of it (like cascading parameters and so on)
When I tried to add one of the reports to my solution it says that it was created with CR version later than installed.
So actually I am trying to open CR10 report with CR.net (which is I believe compatable with CR9).
Is there a solution for this problem?
I cannot upgrate Visual Studio to higher version so don't suggest. Also we are planing to upgrade CR to XI - we need some new features of it (like cascading parameters and so on)
ASKER
I have installed latest service pack for CR.net but it doesn't help.
If you only have the CR 10 Professional Edition, you don't haev a license oto distribute the CR viewing dlls. You need at least the Developer edition.
mlmcc
mlmcc
ASKER
mlmcc - I don't have to use CR10's license - I am distributing VS.Net executable and dll that coming with Visual Studio - correct me if I am wrong
You might be correct but the CR.Net licenses may only apply to CR.Net and not CR 10.
I don't have CR.Net or 10 so I can't check.
mlmcc
I don't have CR.Net or 10 so I can't check.
mlmcc
Loading a CR 10 report from VS 2003 shouldn't be a problem. I'm curious, did you ever try just loading a report with a hard-coded path, filename (not using your mnuFileOpen_Click event/Open file dialog)? Are you sure your connection information is correct? Is your ODBC connection using an UNC path or a mapped drive (try UNC)?
Is this problm occurring in your development environment (this is what I've assumed), but you note "I am distributing VS.Net executable and dll that coming with Visual Studio " If you are deploying your app you need to include the merge modules
Here's some info I found on "load report failed" but not sure if it applies to your specific situation, might be worth a look though
Err Msg: "Load Report Failed" when using an untyped report component in .NET
http://support.businessobjects.com/library/kbase/articles/c2014070.asp
Is this problm occurring in your development environment (this is what I've assumed), but you note "I am distributing VS.Net executable and dll that coming with Visual Studio " If you are deploying your app you need to include the merge modules
Here's some info I found on "load report failed" but not sure if it applies to your specific situation, might be worth a look though
Err Msg: "Load Report Failed" when using an untyped report component in .NET
http://support.businessobjects.com/library/kbase/articles/c2014070.asp
ASKER
janmarini:
I did try loading report by hard-coding the file name. Even more - I tryed to assign Report Source property in Design mode (not in code) - the result is the same: "Load Report Failed" message
The problm occurring in development environment.
As you can see from my post from Date: 05/31/2006 09:46AM EDT I tryed to implement both methods from the article "Err Msg: "Load Report Failed" when using an untyped report component in .NET"
I did try loading report by hard-coding the file name. Even more - I tryed to assign Report Source property in Design mode (not in code) - the result is the same: "Load Report Failed" message
The problm occurring in development environment.
As you can see from my post from Date: 05/31/2006 09:46AM EDT I tryed to implement both methods from the article "Err Msg: "Load Report Failed" when using an untyped report component in .NET"
ASKER
Update:
I was able to open several reports from my application but some of the reports won't open!!!
So I can assume that everything is OK mith my .NET viewer - the problem is in the reports. All reports running out of the same database. I cannot find any noticable difference.
Anybody has an idea where to look?
I was able to open several reports from my application but some of the reports won't open!!!
So I can assume that everything is OK mith my .NET viewer - the problem is in the reports. All reports running out of the same database. I cannot find any noticable difference.
Anybody has an idea where to look?
ASKER
Hehe - got it!!!
Any report that contain "Report Custom Function" fail to load in CRViewer component for .NET
Anybody knows how to resolve it?
Any report that contain "Report Custom Function" fail to load in CRViewer component for .NET
Anybody knows how to resolve it?
Previously you said that all reports have the problem - has something changed with the reports that are now working?
Are there any differences in the reports that work vs. those that don't such as subreports, parameters?
Are you still getting the same error message "Load report failed" for those that don't open.
Are there any differences in the reports that work vs. those that don't such as subreports, parameters?
Are you still getting the same error message "Load report failed" for those that don't open.
ASKER
>>Previously you said that all reports have the problem >> Yes but I am creating new reports :)
Can you post an example of your custom function
ASKER
Any function will cause the problem even if it is only defined and never used
Here is a sample of one I use:
Function pad( s as string, l as number ) as string
pad=Left(s & space(l), l)
End Function
Here is a sample of one I use:
Function pad( s as string, l as number ) as string
pad=Left(s & space(l), l)
End Function
ASKER
janmarini,
As I understand from your Profile you should have VS2003 installed.
Could you do me a favor and try to reproduce this issue on your system.
crate te new windows app and paste following code:
[Code]
Imports CrystalDecisions.CrystalRe ports.Engi ne
Imports CrystalDecisions.Shared
Public Class frmCRViewer
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents CR As CrystalDecisions.Windows.F orms.Cryst alReportVi ewer
Friend WithEvents mnuMain As System.Windows.Forms.MainM enu
Friend WithEvents mnuFile As System.Windows.Forms.MenuI tem
Friend WithEvents mnuFileOpen As System.Windows.Forms.MenuI tem
Friend WithEvents mnuFileSep1 As System.Windows.Forms.MenuI tem
Friend WithEvents mnuFileExit As System.Windows.Forms.MenuI tem
Friend WithEvents dlgOpenReport As System.Windows.Forms.OpenF ileDialog
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Me.CR = New CrystalDecisions.Windows.F orms.Cryst alReportVi ewer
Me.mnuMain = New System.Windows.Forms.MainM enu
Me.mnuFile = New System.Windows.Forms.MenuI tem
Me.mnuFileOpen = New System.Windows.Forms.MenuI tem
Me.mnuFileSep1 = New System.Windows.Forms.MenuI tem
Me.mnuFileExit = New System.Windows.Forms.MenuI tem
Me.dlgOpenReport = New System.Windows.Forms.OpenF ileDialog
Me.SuspendLayout()
'
'CR
'
Me.CR.ActiveViewIndex = -1
Me.CR.Anchor = CType((((System.Windows.Fo rms.Anchor Styles.Top Or System.Windows.Forms.Ancho rStyles.Bo ttom) _
Or System.Windows.Forms.Ancho rStyles.Le ft) _
Or System.Windows.Forms.Ancho rStyles.Ri ght), System.Windows.Forms.Ancho rStyles)
Me.CR.Location = New System.Drawing.Point(0, 0)
Me.CR.Name = "CR"
Me.CR.ReportSource = Nothing
Me.CR.Size = New System.Drawing.Size(680, 528)
Me.CR.TabIndex = 0
'
'mnuMain
'
Me.mnuMain.MenuItems.AddRa nge(New System.Windows.Forms.MenuI tem() {Me.mnuFile})
'
'mnuFile
'
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRa nge(New System.Windows.Forms.MenuI tem() {Me.mnuFileOpen, Me.mnuFileSep1, Me.mnuFileExit})
Me.mnuFile.Text = "&File"
'
'mnuFileOpen
'
Me.mnuFileOpen.Index = 0
Me.mnuFileOpen.Shortcut = System.Windows.Forms.Short cut.F2
Me.mnuFileOpen.Text = "&Open ..."
'
'mnuFileSep1
'
Me.mnuFileSep1.Index = 1
Me.mnuFileSep1.Text = "-"
'
'mnuFileExit
'
Me.mnuFileExit.Index = 2
Me.mnuFileExit.Text = "E&xit"
'
'dlgOpenReport
'
Me.dlgOpenReport.DefaultEx t = "rpt"
Me.dlgOpenReport.Filter = "Crystal Reports files (*.rpt)|*.rpt"
'
'frmCRViewer
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(680, 526)
Me.Controls.Add(Me.CR)
Me.Menu = Me.mnuMain
Me.Name = "frmCRViewer"
Me.Text = "Crystal Reports Viewer"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.Click
Dim FileName As String
If dlgOpenReport.ShowDialog = DialogResult.OK Then
FileName = dlgOpenReport.FileName
Try
CR.ReportSource = FileName
Catch ex As Exception
MsgBox("Cannot open file: " & FileName & ControlChars.CrLf & "Exception: " & ex.Message)
End Try
End If
End Sub
End Class
[/Code]
Try to open a report without Custom Function
It should open just fine
Then modify the report by adding a Custom Function - you dont have to use it anywhere on the report - just define one.
Try to open the report again in Viewer.
BANG!!! Or not?
As I understand from your Profile you should have VS2003 installed.
Could you do me a favor and try to reproduce this issue on your system.
crate te new windows app and paste following code:
[Code]
Imports CrystalDecisions.CrystalRe
Imports CrystalDecisions.Shared
Public Class frmCRViewer
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents CR As CrystalDecisions.Windows.F
Friend WithEvents mnuMain As System.Windows.Forms.MainM
Friend WithEvents mnuFile As System.Windows.Forms.MenuI
Friend WithEvents mnuFileOpen As System.Windows.Forms.MenuI
Friend WithEvents mnuFileSep1 As System.Windows.Forms.MenuI
Friend WithEvents mnuFileExit As System.Windows.Forms.MenuI
Friend WithEvents dlgOpenReport As System.Windows.Forms.OpenF
<System.Diagnostics.Debugg
Me.CR = New CrystalDecisions.Windows.F
Me.mnuMain = New System.Windows.Forms.MainM
Me.mnuFile = New System.Windows.Forms.MenuI
Me.mnuFileOpen = New System.Windows.Forms.MenuI
Me.mnuFileSep1 = New System.Windows.Forms.MenuI
Me.mnuFileExit = New System.Windows.Forms.MenuI
Me.dlgOpenReport = New System.Windows.Forms.OpenF
Me.SuspendLayout()
'
'CR
'
Me.CR.ActiveViewIndex = -1
Me.CR.Anchor = CType((((System.Windows.Fo
Or System.Windows.Forms.Ancho
Or System.Windows.Forms.Ancho
Me.CR.Location = New System.Drawing.Point(0, 0)
Me.CR.Name = "CR"
Me.CR.ReportSource = Nothing
Me.CR.Size = New System.Drawing.Size(680, 528)
Me.CR.TabIndex = 0
'
'mnuMain
'
Me.mnuMain.MenuItems.AddRa
'
'mnuFile
'
Me.mnuFile.Index = 0
Me.mnuFile.MenuItems.AddRa
Me.mnuFile.Text = "&File"
'
'mnuFileOpen
'
Me.mnuFileOpen.Index = 0
Me.mnuFileOpen.Shortcut = System.Windows.Forms.Short
Me.mnuFileOpen.Text = "&Open ..."
'
'mnuFileSep1
'
Me.mnuFileSep1.Index = 1
Me.mnuFileSep1.Text = "-"
'
'mnuFileExit
'
Me.mnuFileExit.Index = 2
Me.mnuFileExit.Text = "E&xit"
'
'dlgOpenReport
'
Me.dlgOpenReport.DefaultEx
Me.dlgOpenReport.Filter = "Crystal Reports files (*.rpt)|*.rpt"
'
'frmCRViewer
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(680, 526)
Me.Controls.Add(Me.CR)
Me.Menu = Me.mnuMain
Me.Name = "frmCRViewer"
Me.Text = "Crystal Reports Viewer"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub mnuFileOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileOpen.Click
Dim FileName As String
If dlgOpenReport.ShowDialog = DialogResult.OK Then
FileName = dlgOpenReport.FileName
Try
CR.ReportSource = FileName
Catch ex As Exception
MsgBox("Cannot open file: " & FileName & ControlChars.CrLf & "Exception: " & ex.Message)
End Try
End If
End Sub
End Class
[/Code]
Try to open a report without Custom Function
It should open just fine
Then modify the report by adding a Custom Function - you dont have to use it anywhere on the report - just define one.
Try to open the report again in Viewer.
BANG!!! Or not?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I couldn't find any usefull info on BO's site so I am going to get rid of Custom functions
Unfortunately you can't just replase Custom function with formula - I am using input parameters which is impossible in formulas.
Unfortunately you can't just replase Custom function with formula - I am using input parameters which is impossible in formulas.
Closest additional info I could find is the following link. I didn't have time to check it out because I have to get to work. When I tested your code I created the report (and repository) on 1 machine (that has CR 9) then copied to the report file to another machine (that has VS 2003)...Perhaps it didn't work because I didn't have the repository (or connection) on the machine with VS 2003. Never have used the repository (or custom functions before) so I don't know if this info will be helpful or not
Err Msg: "Load Report Failed" when using Business Views in VS .NET application .... Applies to CR10.0 -Business View and other Repository objects (which includes custom functions) - sounds like some repository (CE) connection info is needed...
http://support.businessobjects.com/library/kbase/articles/c2014526.asp?ref=devzone_netzone_archive
ASKER
The repository is part of Crystal Enterprize I guess and I am not using it. I am using (OK - was using) Report Custom Functions. There is no logon credentials involved so this link is not applicable to my situation.
Where are you creating the custom function?
mlmcc
mlmcc
ASKER
>>Where are you creating the custom function?
What do you mean by Where?
All reports are build in CR10 (not .NET)
We don't have Enterprise Edition hence I cannot store my functions in centralized repository and i am stuck to Report based functions
What do you mean by Where?
All reports are build in CR10 (not .NET)
We don't have Enterprise Edition hence I cannot store my functions in centralized repository and i am stuck to Report based functions
The repository is where the custom functions are created and stored in Crystal Reports, not Crystal Enterprise. I think the reference to Crystal Enterprise is a little confusing....
The link I sent to you specifically deals with CR 10 - it refers to the EnterpriseSession property of the ReportDocument object.
You may want to read up a little on Repository objects - which include custom functions. You might also want to try adding in the few lines of code suggested in the solution (convert to VB, example is C#). You may have to add a reference to the CrystalEnterpriseLib (Project/Add Refererence/CrystalEnterpr iseLib) and on your VB Form,
Imports CrystalEnterpriseLib
The link I sent to you specifically deals with CR 10 - it refers to the EnterpriseSession property of the ReportDocument object.
You may want to read up a little on Repository objects - which include custom functions. You might also want to try adding in the few lines of code suggested in the solution (convert to VB, example is C#). You may have to add a reference to the CrystalEnterpriseLib (Project/Add Refererence/CrystalEnterpr
Imports CrystalEnterpriseLib
ASKER
I am assuming that there is no solution and in order to use reports in CR Viewer Control for .NET the report cannot contain Custom Functions.
I am accepting janmarini's comment because he spend so much time with me analysing and testing.
Thank you all, guys
I am accepting janmarini's comment because he spend so much time with me analysing and testing.
Thank you all, guys
http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_win_samples.exe.asp
I opened vbnet_win_SimplePreviewRep