Private Sub PrintInvoice() Dim printDoc As New Printing.PrintDocument() AddHandler printDoc.PrintPage, AddressOf PrintPageHandler Dim printDialog1 As New PrintDialog() printDialog1.Document = printDoc If printDialog1.ShowDialog() = DialogResult.OK Then printDoc.Print() End If End Sub Private Sub PrintPageHandler(sender As Object, e As Printing.PrintPageEventArgs) Dim yPos As Single = e.MarginBounds.Top Dim leftMargin As Single = e.MarginBounds.Left Dim font As New Font("Arial", 12) Dim largeFont As New Font("Arial", 16, FontStyle.Bold)
Public Function getConnection() As SqlConnection Return New SqlConnection(connString) End Function vb.net billing software source code
'Header e.Graphics.DrawString("ABC Electronics", largeFont, Brushes.Black, leftMargin, yPos) yPos += 30 e.Graphics.DrawString("Invoice #: " & lblInvoiceNo.Text, font, Brushes.Black, leftMargin, yPos) yPos += 20 e.Graphics.DrawString("Date: " & DateTime.Now.ToShortDateString(), font, Brushes.Black, leftMargin, yPos) yPos += 30 e.Graphics.DrawString("Items:", font, Brushes.Black, leftMargin, yPos) yPos += 20 Private Sub PrintInvoice() Dim printDoc As New Printing
Private Sub CalculateTotal() Dim subTotal As Decimal = 0 For Each row As DataGridViewRow In dgvCart.Rows subTotal += Convert.ToDecimal(row.Cells("Total").Value) Next Share your experience or ask for specific code
Download a sample project, set up the SQL tables, step through the SaveInvoice() function with breakpoints, and watch how a bill moves from the cart to the database. That hands-on experience is worth more than any pre-packaged solution. Have you built a billing system in VB.NET? Share your experience or ask for specific code modules in the comments below.
Whether you are a student completing a final-year project or a small business owner tired of expensive software, VB.NET empowers you to take control. Start with the core modules, iterate with features like GST reporting or customer credit limits, and you will have a professional application ready for deployment.