How to view images from application's path?

victor64

Well-known member
Joined
Nov 9, 2008
Messages
60
Programming Experience
Beginner
How to view image in same path as ACCES file

Hello,

I am trying to view PNG files listed in an ACCESS file, the PNG files are on the same path as the application. Including the following syntax: /intro.png in the
table is not working. Can you please help me with the proper syntax to view the PNG files in the same path as the ACCESS file.

Thanks,

Victor
 
How to View image without specifying file path

Hello,

I am trying to use crystal reports to view PNG files listed in ACCESS, without specifying the files’ path, the PNG files are on the same path as the application when the application is installed. Can you please help me with the proper syntax from the ACCESS table or .NET code to view the PNG files without specifying the files’ path. I would like to give the users the flexibility to install the program to the folder of their choice.

Dim myaop6report As New AOP6Annex
Dim myaop6viewer As New AOP6VIEWER
Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo

crConnectionInfo.ServerName = (Application.StartupPath & "\AOP6Annexes.mdb")
setDBLogonForReporta(crConnectionInfo, myaop6report)
myaop6report.RecordSelectionFormula = "{image.SN} like " & "'*" & 100 & "*'" & ""

With myaop6viewer
.CrystalViewer22.DisplayGroupTree = True
.CrystalViewer22.ReportSource = myaop6report
.Show()
End With
Me.Cursor = Cursors.Default
The Image table currently looks like this

SN IMAGE
100 c:\Program Files\AOP6\Image1.png
100 c:\Program Files\AOP6\Image2.png
100 c:\Program Files\AOP6\Image3.png
100 c:\Program Files\AOP6\Image4.png


Thanks,

Victor
 
Hello,

I am using the codes below to view images from an ACCESS database listed as ".\image.png", the images are included in the application's path. I'm able to view the images while running crystal reports alone; However when I include the same report and databse in my VB.NET application, the images don't show. I was told that the report looks for the images in a temp folder, an alternative solution would be to copy the image files to a temp folder before attempting to run the report, but so many things can go wrong with such approach. Do you have a better solution to this problem?

Thanks in advance.

Victor

Code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myaop6viewer As New aop6viewer
Dim myaop6report As New AOP6V2
Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo
crConnectionInfo.ServerName = (Application.StartupPath & "\AOP6V2.mdb")
crConnectionInfo.Password = "testaop"
setDBLogonForReport(crConnectionInfo, myaop6report)

myaop6report.RecordSelectionFormula = "isnull({image.country}) = false"
With myaop6viewer
.CrystalViewer22.ReportSource = myaop6report
.Show()
End With
myaop6report = Nothing
End Sub

Private Sub setDBLogonForReport(ByVal connection As ConnectionInfo, ByVal report As ReportDocument)
Dim mytables As Tables = report.Database.Tables
Dim mytable As CrystalDecisions.CrystalReports.Engine.Table

For Each mytable In mytables
Dim mytablelogoninfo As TableLogOnInfo = mytable.LogOnInfo
mytablelogoninfo.ConnectionInfo = connection
mytable.ApplyLogOnInfo(mytablelogoninfo)
Next
End Sub
 
Back
Top