CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 1999
    Posts
    32

    Graphics in DataReports

    I placed an image control on a data report. I am using ADO to access a database however, I am not using a Data Environment. The following sample code functions well for populating a label:

    With rptInvoice
    set .DataSource = rsPrint
    .Sections.Item(1).Controls.Item(1).Caption = rsPrint.Fields(6).Value
    end with



    Now, the table rsPrint refers to contains the full path to the graphic image I wish to use (C:\1.jpg for instance). I would have thought that using the code:

    .Sections.Item(1).Controls.Item(2).Picture = LoadPicture(rsPrint.Fields(2).Value)



    would work but it does not. Trying

    .Sections.Item(1).Controls.Item(2).Picture = rsPrint.Fields(2).Value



    also returns an error. I am absolutely sure the left hand side points to the Image control and the right hand side contains the correct path so there must be a problem in syntax. How can I load a graphic image into this graphic control?

    TIA
    Ken


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Graphics in DataReports

    For typical picture items & LoadPicture command use Set

    set ....Picture = LoadPicture(...)




    See example on LoadPicture. If you have trouble still, try copying the path into a local string variable and try. You can also check for File existance this way



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured