Solved

Set crystal report image at runtime in vb.net

Posted on 2007-04-07
2
321 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
  • 2
2 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 18869189
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18966944
Glad i could help

mlmcc
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now