Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Set crystal report image at runtime in vb.net

Posted on 2007-04-07
2
Medium Priority
?
329 Views
Last Modified: 2010-04-23
Hi Experts,

I have the following code: -

Imports System.Windows
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form1
    Dim rpt As New CrystalReport1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As Integer
        Dim imageData() As Byte

        Dim ds As New InvoiceDataSet
        Dim imagepath As String = "c:\test.gif"
        Dim fi As New System.IO.FileInfo(imagepath)
        Dim imgstream As System.IO.Stream = fi.OpenRead
        x = CType(imgstream.Length, Integer)
        ReDim Preserve imageData(x)
        x = CType(fi.Length, Integer)
        imgstream.Read(imageData, 0, x)
        ds.DataTable1.AddDataTable1Row(imageData)

        rpt.Load(Forms.Application.StartupPath & "\crystalreport1.rpt")
        rpt.SetDataSource(InvoiceDataSet1.Tables(0))
        CrystalReportViewer1.ReportSource = rpt
    End Sub
End Class

What I am trying to do is place an image onto a crystal report using vb.net 2005 with the in built crystal report function. My problem is that when I place the array into the dataset the datagrid viewer that I have set to view what’s in the dataset it always shows a red x almost like internet explorer when the image can not be found. I have set the dataset field to byte(). What am I doing wrong please?

Many Thanks
Lee
0
Comment
Question by:ljhodgett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 18869189
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 18966944
Glad i could help

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question