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

Thread: print report

  1. #1
    Join Date
    Aug 2000
    Location
    india
    Posts
    191

    print report

    Is it possible to print & preview a report using vb controls only? I donot want to use any third party tools like crystal report & not even datareport available with vb.


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

    Re: print report

    Actually, yes, and it's not even *that* hard. We're writing on at work at the moment.
    The way we do it is like:
    Put a picturebox on a form, this will be the paper. You can use the printer object to determine the width and height. Put labels on the picturebox where you want the text to appear.
    For printing, you can use the left and the top of the label, set the currentx and currenty properties of the printer, set the font, and you can print.
    Well that's in very short, how we started it as a test. Right now, we have split up the report in a header, footer, lines, and optional subheader and subtotal fields.
    In the designer you can set the fontsize etc, alignment of the label. We have a preview on the screen, and print to printer. So far, testing with different printers, it's all really WYSIWYG (as good as Crystal Reports is that). We also implemented some formula stuff.
    It's a bit too much to explain in detail how to set it all up, if it's about having a print function for 1 standart report, it's not so hard to design a report in the IDE and use that to write the print routine. The hardest thing is if you have sublines (repeated info on the print), and an header and footer, to calculate how much space is left (but, with textheight and textwidth functions it's not that hard after all).
    If more ppl are intrested in it, I can see if I can make a sample exe to show it, and write some sort of tutorial how to write it (will take a few weeks though). And I have to be careful with that not to use the real code, since I'm not allowed to use code I write at work for other stuff).

    Crazy D :-)
    "One ring rules them all"

  3. #3
    Join Date
    Jun 2003
    Location
    India
    Posts
    22

    Lightbulb Customer Reporting Tool

    If Possible then please send me ur reporting tool

    my mail id : satakare@yahoo.com
    Satish

  4. #4
    Join Date
    Jul 2002
    Posts
    42

    That's interesting!

    Hi Crazy_D,
    I saw your post and I got interested on it. I also want to print without using crystal rpt,instead I'm gonna use vb controls like picture box.Can you send me a sample code for it?
    Thanks!

    glenford@secomp-intl.com
    Thanks! <glenford@secomp-intl.com>

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