Solved

Set crystal report image at runtime in vb.net

Posted on 2007-04-07
2
313 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
Comment Utility
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
Glad i could help

mlmcc
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

16 Experts available now in Live!

Get 1:1 Help Now