Re: Report Designer - Setting Picture Property

WinForms

ComponentOne's WinForms controls

Report Designer - Setting Picture Property

  • rated by 0 users
  • This post has 5 Replies |
  • 1 Follower
  • I am trying to load an image into a field as the report is being displayed
    by doing the following:
    1. Pass the directory of where images are located into a field located
    in the PageHeader section
    2. Load the FileNames of the images from the database in the Details
    section
    3. Create the full path to the image by appending the value from the
    database field with the directory value
    4. Assign the full path (from Step 3) to the Picture property of the
    picture field through the Section.OnPrint event


    Here is the code I am using to do this:
    1.
    'In VB.NET
    rpt.Load(strReportDefinitionPath, strReportName)
    rpt.DataSource.ConnectionString = strConn
    rpt.Fields("lblPicturePath").Text = strDirectory
    ppv.Document = rpt.Document

    2.
    'This is just a database field added to the Details section of the report

    3 and 4.
    'In the OnPrint event of the Details section
    picCanine.Picture = lblPicturePath.Text & txtPhotoPath.Text


    After doing all of this, I am not getting an image displayed in the field of
    the report. I have also tried setting the BackStyle of the picture field to
    'Opaque' which did not work. I have also checked the path going to the
    Picture property by:

    picCanine.Text = lblPicturePath.Text & txtPhotoPath.Text

    which returns the correct value. Is there a routine that needs to be called
    after setting the Picture property?


    Thanks,
    Jody


    Click here to view the original newsgroup article (read only).

  • Hi Jody.

    I tried this and it worked fine. My sample is attached.



    "Jody Gelowitz" wrote in message
    news:3d497c12@news.componentone.com...
    > I am trying to load an image into a field as the report is being displayed
    > by doing the following:
    > 1. Pass the directory of where images are located into a field
    located
    > in the PageHeader section
    > 2. Load the FileNames of the images from the database in the Details
    > section
    > 3. Create the full path to the image by appending the value from the
    > database field with the directory value
    > 4. Assign the full path (from Step 3) to the Picture property of the
    > picture field through the Section.OnPrint event
    >
    >
    > Here is the code I am using to do this:
    > 1.
    > 'In VB.NET
    > rpt.Load(strReportDefinitionPath, strReportName)
    > rpt.DataSource.ConnectionString = strConn
    > rpt.Fields("lblPicturePath").Text = strDirectory
    > ppv.Document = rpt.Document
    >
    > 2.
    > 'This is just a database field added to the Details section of the report
    >
    > 3 and 4.
    > 'In the OnPrint event of the Details section
    > picCanine.Picture = lblPicturePath.Text & txtPhotoPath.Text
    >
    >
    > After doing all of this, I am not getting an image displayed in the field
    of
    > the report. I have also tried setting the BackStyle of the picture field
    to
    > 'Opaque' which did not work. I have also checked the path going to the
    > Picture property by:
    >
    > picCanine.Text = lblPicturePath.Text & txtPhotoPath.Text
    >
    > which returns the correct value. Is there a routine that needs to be
    called
    > after setting the Picture property?
    >
    >
    > Thanks,
    > Jody
    >
    >


    Click here to view the original newsgroup article (read only).

  • Thanks for the sample. I got it to work.

    Thanks,
    Jody


    "Bernardo de Castilho" wrote in message
    news:3d49c400@news.componentone.com...
    > Hi Jody.
    >
    > I tried this and it worked fine. My sample is attached.
    >
    >
    >
    > "Jody Gelowitz" wrote in message
    > news:3d497c12@news.componentone.com...
    > > I am trying to load an image into a field as the report is being
    displayed
    > > by doing the following:
    > > 1. Pass the directory of where images are located into a field
    > located
    > > in the PageHeader section
    > > 2. Load the FileNames of the images from the database in the
    Details
    > > section
    > > 3. Create the full path to the image by appending the value from
    the
    > > database field with the directory value
    > > 4. Assign the full path (from Step 3) to the Picture property of
    the
    > > picture field through the Section.OnPrint event
    > >
    > >
    > > Here is the code I am using to do this:
    > > 1.
    > > 'In VB.NET
    > > rpt.Load(strReportDefinitionPath, strReportName)
    > > rpt.DataSource.ConnectionString = strConn
    > > rpt.Fields("lblPicturePath").Text = strDirectory
    > > ppv.Document = rpt.Document
    > >
    > > 2.
    > > 'This is just a database field added to the Details section of the
    report
    > >
    > > 3 and 4.
    > > 'In the OnPrint event of the Details section
    > > picCanine.Picture = lblPicturePath.Text & txtPhotoPath.Text
    > >
    > >
    > > After doing all of this, I am not getting an image displayed in the
    field
    > of
    > > the report. I have also tried setting the BackStyle of the picture
    field
    > to
    > > 'Opaque' which did not work. I have also checked the path going to the
    > > Picture property by:
    > >
    > > picCanine.Text = lblPicturePath.Text & txtPhotoPath.Text
    > >
    > > which returns the correct value. Is there a routine that needs to be
    > called
    > > after setting the Picture property?
    > >
    > >
    > > Thanks,
    > > Jody
    > >
    > >
    >
    >
    >


    Click here to view the original newsgroup article (read only).

  •  I can't see the attachment... Can you help me with this. My problem is how to load the picture in report viewer using vb.net 2008

    I used this code the code below but nothing happens

    Me.C1Report1.Sections("Header").OnFormat = "Field1.Picture=D:\Program\AIS Enterprise System 2009\AIS.Report\goldwin.jpg"

    Thanks guys for your help

  •  I read some thread in the forum and it is the same on my problem, by the way where I can download the PrintPreviewControl. It is not present on my installer. Thanks guys

  • Use following code:

    Me.C1Report1.Sections("Header").OnFormat = "Field1.Picture=""D:\Program\AIS Enterprise System 2009\AIS.Report\goldwin.jpg"""

Page 1 of 1 (6 items)