0

I am working with a billing application in VB.NET .I have few textboxes, labels and DataGridView. I need to generate a receipt like the invoice with the data from textbox , label and datagridview. If the datagridview items does not fit in one Page then it should be taken to the next page. I am new to printing in VB.NET please help me with the possible solutions. I have seen many questions and answers on StackOverflow but everything is advance , I am a beginner in this topic.

VB.NET framework 4.6.2

I have tried Graphics DrawString but previewing it is a time consuming process

  • Create `RDLC` report manually or [generate RDLC report from DataGridView](https://stackoverflow.com/a/40367119/3110834). As another option you can [generate HTML using T4](https://stackoverflow.com/a/39713817/3110834) and print. – Reza Aghaei Jan 26 '19 at 14:04
  • Ok @RezaAghaei Thank you .I will let you know after trying this – Siva chidambaram Jan 26 '19 at 15:44
  • 1
    @Sivachidambaram If "previewing it is a time consuming process" implies that you are printing to paper to check the work, I suggest using the Microsoft XPS Document Writer instead, if that is available on your computer. – Andrew Morton Jan 26 '19 at 16:02
  • @AndrewMorton Thank you for your reply. I was using the same you have mentioned,but is there any real-time or code generation tool for templates? – Siva chidambaram Jan 26 '19 at 16:42

1 Answers1

0

I know that this is a very old thread but have only just seen it.

I wrote a multi part blog posted on VBCity in December 2012. I used Visual Basic 2008 but it also works in VB2013. I called it "Printing a datagridview in an invoice with visual basic express 2008". It is rather long winded because it was written for a beginners. It details the form layout and how to associate form controls with "My Settings". Here is the link to part 1: http://vbcity.com/blogs/mikenewman/archive/2012/12/28/printing-a-datagridview-in-an-invoice-with-visual-basic-express-2008-part-1.aspx.

I modified the code to include another form to change the font and colours on the invoice and that is also available on VBCity. Here is the link: http://vbcity.com/blogs/mikenewman/archive/2012/12/31/print-a-datagridview-in-an-invoice-using-visual-basic-express-2008-v2.aspx.

As the code is hundreds of lines long, I have attached text and zip files to the end of each part which can be downloaded and pasted into your code editor.

user967360
  • 39
  • 3