i am working on a vb project in which need has arised to print an invoice. however the problem is that the contents of the invoice is accompanied by horizontal and vertical lines. Also the so-formed rows and columns are not regular. My question is how can i print such a form. I mean the printout should also have the horizontal and vertical lines along with the data.
i have attached the desired format along with this post. Please take time to view it.
Can anyone give me some solution..other than printform ... :|

Hi,
I am also having this problem. but i solved this using Printer.PaintPicture. To print invoice, you draw lines and text in any picture box then use this Printer.PaintPicture Method to print the invoice. The picture box or form you are using to draw invoice must represent the real unit. For example picture box width and height should be equal with the paper width and height.

One more thing, For drawing text, PictureBox.Print may not be useful. Instead use DrawText() API.

Hi,
I am also having this problem. but i solved this using Printer.PaintPicture. To print invoice, you draw lines and text in any picture box then use this Printer.PaintPicture Method to print the invoice. The picture box or form you are using to draw invoice must represent the real unit. For example picture box width and height should be equal with the paper width and height.

One more thing, For drawing text, PictureBox.Print may not be useful. Instead use DrawText() API.

err...umm...can you provide me any sample code of this .paintpicture thing? :|

Sample Code

Draw Two Command Buttons (cmdDraw, cmdPrint)
Draw Two PictureBox (Picture1, Picture2)

and Try the Coding

Private Sub cmdDraw_Click()
   Picture1.Appearance = 0
   Picture1.Line (0, 0)-(Picture1.ScaleWidth, Picture1.ScaleHeight)
   Picture1.Line (0, Picture1.ScaleHeight)-(Picture1.ScaleWidth, 0)
End Sub

Private Sub cmdPrint_Click()
   Picture2.PaintPicture Picture1.Image, 0, 0
   '
   'Printer.PaintPicture Picture1.Image, 0, 0
   'Printer.EndDoc
End Sub

Usage: First Click on cmdDraw, it draws a cross mark. Then click cmdPrint to copy image to picturebox2.

Note: If you want to test with printer, uncomment the above coding

This article has been dead for over six months. Start a new discussion instead.