File converter  /  Video  /  Convert to MKV  /  MOV converter  /  MKV to MOV

Vb.net Billing Software Source Code [work] Access

I'll provide you with a comprehensive guide and source code for a basic billing software system in VB.NET with SQL Server database.

1. Database Connection (Using SqlConnection)

Create a module mod_DB.vb to centralize your connection string:

Imports System.Data.SqlClient

Module mod_DB Public connString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=BillingDB;Integrated Security=True"

Public Function getConnection() As SqlConnection
    Return New SqlConnection(connString)
End Function
Public Function ExecuteNonQuery(ByVal query As String) As Integer
    Using conn As SqlConnection = getConnection()
        conn.Open()
        Using cmd As New SqlCommand(query, conn)
            Return cmd.ExecuteNonQuery()
        End Using
    End Using
End Function

End Module

Tables and Relationships

-- 1. Product table
CREATE TABLE tbl_Product (
    ProductID INT PRIMARY KEY IDENTITY(1,1),
    ProductCode NVARCHAR(50) UNIQUE,
    ProductName NVARCHAR(200),
    Unit NVARCHAR(20),
    SellingPrice DECIMAL(18,2),
    GST_Percent DECIMAL(5,2),
    StockQuantity DECIMAL(18,2)
);

-- 2. Customer table CREATE TABLE tbl_Customer ( CustomerID INT PRIMARY KEY IDENTITY(1,1), CustomerName NVARCHAR(150), GSTIN NVARCHAR(15), Address NVARCHAR(500), Mobile NVARCHAR(15) );

-- 3. Invoice Master table CREATE TABLE tbl_Invoice_Master ( InvoiceNo INT PRIMARY KEY, InvoiceDate DATETIME, CustomerID INT FOREIGN KEY REFERENCES tbl_Customer(CustomerID), SubTotal DECIMAL(18,2), DiscountPercent DECIMAL(5,2), TaxAmount DECIMAL(18,2), GrandTotal DECIMAL(18,2) );

-- 4. Invoice Details table CREATE TABLE tbl_Invoice_Details ( DetailID INT PRIMARY KEY IDENTITY(1,1), InvoiceNo INT FOREIGN KEY REFERENCES tbl_Invoice_Master(InvoiceNo), ProductID INT FOREIGN KEY REFERENCES tbl_Product(ProductID), Quantity DECIMAL(18,2), Rate DECIMAL(18,2), Amount DECIMAL(18,2) );

This structure allows full referential integrity and easy report generation.


5. Licensing and legal considerations

  • Identify license files (MIT, GPL, Apache). GPL code may require making your combined work GPL if distributed.
  • Contributor provenance and patent clauses.
  • Verify whether bundled libraries have compatible licenses.
  • If using in commercial product, prefer permissive licenses or obtain legal review.

4. Security risks & checklist

  • SQL injection via concatenated SQL statements — look for use of AddWithValue or parameterized SqlCommand.
  • Hard-coded credentials or API keys in source or config files.
  • Weak password storage (plain text or reversible encryption).
  • Inadequate input validation (client-side only).
  • Insecure file handling (path traversal when exporting invoices).
  • Insecure direct object references (exposing internal IDs).
  • Missing authorization checks on sensitive operations (invoice modification, refunds).
  • Outdated third-party libraries with known vulnerabilities.

Action items: scan for parameterized queries, secret strings, password hashing (bcrypt/scrypt/PBKDF2), validate inputs server-side, audit libraries.


8. Recommendations before adoption

  1. Run static analysis and security scan (e.g., SonarQube, Roslyn analyzers).
  2. Search the codebase for secrets and remove/rotate any found.
  3. Replace raw SQL concatenation with parameterized queries or ORM.
  4. Implement proper password hashing and role-based authorization.
  5. Add logging, error handling, and input validation.
  6. Establish licensing compliance and document third-party components.
  7. Write unit tests for core billing calculations (tax, discounts, totals).
  8. If long-term use is planned, refactor toward layered architecture and introduce CI/CD.

4. Generating a Printable Bill (VB.NET PrintDocument)

The final piece is printing. Using the PrintDocument component from the toolbox:

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) 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
'Loop through DataGridView rows and print them
For Each row As DataGridViewRow In dgvCart.Rows
    Dim line As String = row.Cells("ProductName").Value & " x " & row.Cells("Quantity").Value & " = " & row.Cells("Total").Value
    e.Graphics.DrawString(line, font, Brushes.Black, leftMargin, yPos)
    yPos += 20
Next
'Total
yPos += 20
e.Graphics.DrawString("Grand Total: " & lblGrandTotal.Text, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, leftMargin, yPos)

End Sub

The Secret Weapon for Freelancers: Why You Should Build Your Billing System with VB.NET Source Code

Are you tired of the monthly subscription fees of QuickBooks? Frustrated that your current invoicing software doesn’t quite fit your specific business workflow?

Every business owner reaches a breaking point where they think, "I could build this myself." If you are a developer or a tech-savvy entrepreneur, diving into VB.NET billing software source code might be the best business decision you make this year. I'll provide you with a comprehensive guide and

In this post, we’re going to explore why legacy tech isn’t dead, where to find the right source code, and how customizing your own billing engine can save you thousands of dollars.