Click here to Skip to main content
       

Visual Basic

 
GeneralRe: Bitwise AND in an If/Else block PinmvpRichard MacCutchan8-May-13 20:56 
GeneralRe: Bitwise AND in an If/Else block Pinmembertreddie8-May-13 22:14 
AnswerRe: Bitwise AND in an If/Else block PinmvpRichard MacCutchan9-May-13 1:07 
GeneralRe: Bitwise AND in an If/Else block Pinmembertreddie10-May-13 16:14 
GeneralRe: Bitwise AND in an If/Else block PinmvpRichard MacCutchan8-May-13 2:53 
AnswerRe: Bitwise AND in an If/Else block PinmemberTnTinMn8-May-13 3:24 
GeneralRe: Bitwise AND in an If/Else block Pinmembertreddie8-May-13 22:15 
Questioncascading comboboxes vb.net windows forms PinmemberAgontuk6-May-13 8:39 
AnswerRe: cascading comboboxes vb.net windows forms PinprofessionalThePhantomUpvoter6-May-13 10:15 
GeneralRe: cascading comboboxes vb.net windows forms PinmemberAgontuk7-May-13 0:42 
AnswerRe: cascading comboboxes vb.net windows forms PinprofessionalSimon_Whale7-May-13 1:30 
AnswerRe: cascading comboboxes vb.net windows forms PinmvpDave Kreskowiak7-May-13 1:44 
GeneralRe: cascading comboboxes vb.net windows forms PinmemberAgontuk9-May-13 8:53 
QuestionHow to export the data from datagridview & all the data on the form1.vb make a report Pinmemberchandan H T5-May-13 1:24 
Hi I'm using Visual studio 2010 i'm creating a invoice billing software. i can access the data from database to datagridview and calculate the sum of all products. now i want a print function so i need to make a report please help me out this
 
Thanks in advance.
 
Public Class Form1
 
Dim ID As String = Nothing
Dim pname As String = Nothing
Dim qty As UInteger = Nothing
Dim rate As Decimal = Nothing
Dim amt As Decimal = Nothing
Dim i As UInteger
Dim count As UInteger = Nothing
Dim totalAmt
Dim salesTax
Dim salesTaxRate
 
Private Sub AddProduct_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddProduct.Click
Dim MaxRows As UInteger = Nothing
Dim pid As String
Dim found As Boolean = False
Dim Sql As String
Dim count As UInteger = Nothing
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\IMPossible\Music\Project\BillingInvoice\BillingInvoice\InvoiceDatabase.accdb"
count = count + 1
con.Open()
Dim productAdapter As OleDb.OleDbDataAdapter = Nothing
Dim productDataSet As New DataSet
Dim validID As Boolean = True
Dim validQty As Boolean = True
 
Sql = "SELECT Product_ID,Product_Name,Product_Rate FROM Product_Data"
 

productAdapter = New OleDb.OleDbDataAdapter(Sql, con)
productAdapter.Fill(productDataSet, "Prod_Data")
If txtID.Text = "" Then
MsgBox("Enter a valid ProductID")
validID = False
End If
If txtqty.Text = "" Then
MsgBox("Enter a valid quantity")
validQty = False
End If
If validID And validQty Then
Try
qty = CInt(txtqty.Text)
ID = txtID.Text.ToUpper
Catch ex As Exception
MsgBox("qty can't be empty")
End Try
End If
 
MaxRows = productDataSet.Tables("Prod_Data").Rows.Count
 
' Get the data for the new line item.
If MaxRows = 0 Then
MsgBox("No Product Found")
Else
i = 0
Do Until i >= MaxRows
pid = productDataSet.Tables("Prod_Data").Rows(i).Item(0)
 
If ID = pid Then
found = True
pname = productDataSet.Tables("Prod_Data").Rows(i).Item(1)
rate = productDataSet.Tables("Prod_Data").Rows(i).Item(2)
txtpname.Text = pname
txtrate.Text = rate
amt = qty * rate
txtamt.Text = amt
DataGridView.Rows.Add(New String() {ID, pname, qty, rate, amt})
End If
 
i = i + 1
 
Loop
If found <> True Then
MsgBox("NO product found")
End If
 
End If
 

 
con.Close()
 
' Clear the total text boxes.
txtTotalAmt.Text = ""
txtTax.Text = ""
txtGrandTotal.Text = ""
txtTotalProd.Text = ""
 

 

 
Dim totalAmt As Integer
For Each r As DataGridViewRow In DataGridView.Rows
Dim prodAmount As Integer = CInt(r.Cells(4).Value)
totalAmt += prodAmount
Next
txtTotalProd.Text = totalAmt
 

 

 

 

 
' Calculate the sales tax.
 

salesTax = 12.5
txtTax.Text = salesTax
 
' Calculate the total prod
Dim totalQuantity As Integer
For Each r As DataGridViewRow In DataGridView.Rows
Dim prodQty As Integer = CInt(r.Cells(2).Value)
totalQuantity += prodQty
Next
txtTotalProd.Text = totalQuantity
 

' Calculate the invoice total.
Dim invoiceTotal = totalAmt + salesTax
 
' Display the invoice totals.
txtTotalAmt.Text = FormatCurrency(totalAmt)
txtTax.Text = FormatCurrency(salesTax)
txtGrandTotal.Text = FormatCurrency(invoiceTotal)
End Sub
End Class
AnswerRe: How to export the data from datagridview & all the data on the form1.vb make a report PinmvpEddy Vluggen5-May-13 8:49 
QuestionTreeView Find not working Pinmembertreddie4-May-13 22:17 
AnswerRe: TreeView Find not working PinmvpEddy Vluggen5-May-13 8:45 
GeneralRe: TreeView Find not working Pinmembertreddie5-May-13 9:44 
GeneralRe: TreeView Find not working PinmvpEddy Vluggen5-May-13 10:06 
GeneralRe: TreeView Find not working Pinmembertreddie5-May-13 14:51 
GeneralRe: TreeView Find not working Pinmemberjan212r5-May-13 20:55 
GeneralRe: TreeView Find not working Pinmembertreddie5-May-13 23:02 
AnswerRe: TreeView Find not working PinmvpEddy Vluggen6-May-13 7:45 
GeneralRe: TreeView Find not working Pinmembertreddie6-May-13 11:02 
GeneralRe: TreeView Find not working PinmvpEddy Vluggen7-May-13 0:33 
GeneralRe: TreeView Find not working Pinmembertreddie7-May-13 8:25 
GeneralRe: TreeView Find not working PinmvpEddy Vluggen7-May-13 9:06 
GeneralRe: TreeView Find not working Pinmembertreddie7-May-13 11:57 
GeneralRe: TreeView Find not working PinmvpEddy Vluggen8-May-13 7:01 
QuestionView the changes in the database by DATA SET... PinmemberVb Rnd4-May-13 6:23 
AnswerRe: View the changes in the database by DATA SET... PinmvpEddy Vluggen5-May-13 8:38 
QuestionPathTooLongException and Solutions? [modified] Pinmembertreddie3-May-13 9:38 
AnswerRe: PathTooLongException and Solutions? PinmvpEddy Vluggen5-May-13 9:43 
GeneralRe: PathTooLongException and Solutions? Pinmembertreddie5-May-13 9:50 
GeneralRe: PathTooLongException and Solutions? PinmvpEddy Vluggen5-May-13 10:04 
QuestionHow do i save all opened windows PinmemberMember 46241693-May-13 3:16 
AnswerRe: How do i save all opened windows PinmemberGuyThiebaut3-May-13 4:23 
QuestionHow do i save all opened windows PinmemberMember 46241693-May-13 2:56 
QuestionTry Catch does not Execute Catch code [modified] Pinmembertreddie2-May-13 18:31 
AnswerRe: Try Catch does not Execute Catch code PinmvpRichard MacCutchan2-May-13 21:41 
GeneralRe: Try Catch does not Execute Catch code Pinmembertreddie2-May-13 22:02 
QuestionMethod signature does not match delegate - thread safe PinmemberMember 100187622-May-13 7:12 
AnswerRe: Method signature does not match delegate - thread safe PinprofessionalRichard Deeming2-May-13 8:21 
GeneralRe: Method signature does not match delegate - thread safe PinmemberMember 100187622-May-13 11:00 
GeneralRe: Method signature does not match delegate - thread safe PinmemberAlan N2-May-13 12:26 
QuestionTrouble passing arguments to System.Diagnostics.Process.Start Pinmembersavedlema2-May-13 0:07 
AnswerRe: Trouble passing arguments to System.Diagnostics.Process.Start [modified] PinmvpRichard MacCutchan2-May-13 1:07 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start PinprofessionalRichard Deeming2-May-13 1:23 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start PinmvpRichard MacCutchan2-May-13 1:27 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pinmembersavedlema2-May-13 8:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 13 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid