Private Sub btnNewBill_Click(sender As Object, e As EventArgs) Handles btnNewBill.Click ResetBill() End Sub
' Save Bill Items For Each row As DataGridViewRow In dgvItems.Rows If Not row.IsNewRow Then SaveBillItem(billID, CInt(row.Cells("colProductID").Value), CInt(row.Cells("colQty").Value), CDec(row.Cells("colPrice").Value), CDec(row.Cells("colTotal").Value)) End If Next vb.net billing software source code
Private Function SaveCustomer(name As String, mobile As String, gstin As String) As Integer Dim query As String = "INSERT INTO Customers (Name, Mobile, GSTIN) VALUES (@name, @mob, @gst); SELECT SCOPE_IDENTITY()" Using conn As New OleDbConnection(connString) Dim cmd As New OleDbCommand(query, conn) cmd.Parameters.AddWithValue("@name", name) cmd.Parameters.AddWithValue("@mob", mobile) cmd.Parameters.AddWithValue("@gst", gstin) conn.Open() Return CInt(cmd.ExecuteScalar()) End Using End Function Main Form – frmBilling
' Save Bill Header Dim billID As Integer = SaveBillHeader(custID, CDec(lblSubtotal.Text), CDec(lblTax.Text), CDec(lblDiscount.Text), CDec(lblGrandTotal.Text)) Private Sub btnNewBill_Click(sender As Object
ItemID (AutoNumber, PK) BillID (Number) ProductID (Number) Quantity (Number) Price (Currency) Total (Currency) Note : This is a working minimal example. Add error handling, data validation, and DB connection string as needed. 1. Main Form – frmBilling.vb Imports System.Data.OleDb Public Class frmBilling