CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Picture print?

  1. #1
    Join Date
    Nov 1998
    Location
    Illinois
    Posts
    24

    Picture print?



    I want to print a gif/jpg file,so i use the "PrintPicture" method.


    Printer.PaintPicture Picture1.Picture, Picture1.Left, Picture1.Top, _

    Picture1.Width, Picture1.Height, vbMergeCopy


    But when the programe runs,the system reports run-time error 5.

    What's the error mean?


    Thanks.

  2. #2
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: Picture print?



    Error 5 = Invalid procedure call or argument

    You can easily check that yourself when the error occurs, go into breakmode and use the debug window (immediate window): ? err.description

    It means that you call a function/method which uses more arguments than you pass. In this case, this is the function declaration:


    object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode

    As you see, it has more arguments then you're call to the function. You probably misunderstoord the part in the help which says optional;. It means that you don't have to enter values for that, but, if there are more arguments, you need to enter a few comma's, thus I think this should work:


    Printer.PaintPicture Picture1.Picture, Picture1.Left, Picture1.Top, _

    Picture1.Width, Picture1.Height, , , , , vbMergeCopy


    Note: if an optional argument is the last argument in a function call, you can simply ignore it. In this case, it isn't, so use empty values (see above)

    Hope it helps!




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