Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. External Images

External Images

Scheduled Pinned Locked Moved Visual Basic
csharpwinformshelpworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stephen Lintott
    wrote on last edited by
    #1

    Hi all... I'm working on a report (Reporting Services) with an external image. The problem is it's not showing up. I'm passing the image through as a base64 string to the report and converting it back to bytes using the Convert.FromBase64String function. The code is as follows

    Dim location As String = Configuration.ConfigurationSettings.AppSettings("location")
    Dim reader1 As New System.IO.StreamReader(location)
    Dim base64 As String
    Dim BinRead As New BinaryReader(reader1.BaseStream)
    Dim file1 As New FileInfo(location)
    base64 = Convert.ToBase64String(BinRead.ReadBytes(CType(file1.Length, Integer)))
    Dim param As New Microsoft.Reporting.WinForms.ReportParameter("Image", base64, False)
    Dim al As New List(Of Microsoft.Reporting.WinForms.ReportParameter)
    al.Add(param) ReportViewer1.LocalReport.EnableExternalImages = True ReportViewer1.LocalReport.SetParameters(al) ReportViewer1.RefreshReport()
    .
    .
    .

    Please ignore the BinReader / Reader bit. I havn't fixed that up yet. If someone can please tell me why this thing is not showing an image. I would be very greatful.

    Stephen Lintott Bsc IT (RAU)

    L 1 Reply Last reply
    0
    • S Stephen Lintott

      Hi all... I'm working on a report (Reporting Services) with an external image. The problem is it's not showing up. I'm passing the image through as a base64 string to the report and converting it back to bytes using the Convert.FromBase64String function. The code is as follows

      Dim location As String = Configuration.ConfigurationSettings.AppSettings("location")
      Dim reader1 As New System.IO.StreamReader(location)
      Dim base64 As String
      Dim BinRead As New BinaryReader(reader1.BaseStream)
      Dim file1 As New FileInfo(location)
      base64 = Convert.ToBase64String(BinRead.ReadBytes(CType(file1.Length, Integer)))
      Dim param As New Microsoft.Reporting.WinForms.ReportParameter("Image", base64, False)
      Dim al As New List(Of Microsoft.Reporting.WinForms.ReportParameter)
      al.Add(param) ReportViewer1.LocalReport.EnableExternalImages = True ReportViewer1.LocalReport.SetParameters(al) ReportViewer1.RefreshReport()
      .
      .
      .

      Please ignore the BinReader / Reader bit. I havn't fixed that up yet. If someone can please tell me why this thing is not showing an image. I would be very greatful.

      Stephen Lintott Bsc IT (RAU)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      First you should convert your stream to Bitmap object then you can put it on Picture Image. Bitmap bitmap = new Bitmap (stream); Best Regard Anubhava Dimri

      mailto: anubhava.prodata@gmail.com

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups