I'm Developing A very Basi App For Generating Bill On A retail shop I'm Using Access(mdb) As Data Base The Table with Name "Invoice"(Holds grand Total And Deposited Against That Invoice) On which I wants to perform task has fields As Follow:

InvoiceId , CustomerId , CustomerName , InvoiceTotal , InvoiceDeposited, InvoiceDate

Now ON my C# Form There Are A text Box for entering CustomerId On text Change Event I wants To Get The Due Amount Till Now And I wants TO Bound That Value to A Lable

finally

Lable.text=( (Sum Of All InvoiceTotal Entries For that CustomerID) -  
             (Sum Of All InvoiceDeposited Entries For that CustomerID)  )

How to reach the Desired Result ...??. Please Help ..!!

Recommended Answers

All 4 Replies

What code have you got so far?

I don't Have Any Idea How to To That ?

The TextBox has a TextChanged event where you can do your logic. However, that's not smart. As every input in that TextBox would fire-up the event. You can narrow it down to only fire-up when "Enter" key is pressed inside the TextBox (check if event args key is Enter).

As for the calculations... simple select from database where CustomerId = TextBox.Text and set Label.Text = value of calculations. If you don't know the syntax... Click Here

Hi,
What you can do is.
Either on the TextChanged event or Leave event. you have to fetch sum of InvoiceTotal from your DB.
than you have to store the resule into a one variable may be string. convert your result into a string and disply to a Lable. this is a very basic way to go.
you can use other complex way also but i am suggesting this as you looks new to technology

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.