|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sum inside a tableI have a form and 5 textbox bounded to a table, called Listing; this table
contains many records; every textbox bounds to a different column and show some price (price1, price2, ...price5). I add, update and display the records just using the binding navigator. Then I need another textbox that must show the sum of all the 5 prices. This 'total' field must then be written in a column, called Total, inside the same table. Obviously I want this value comes automatically, so when I go through records I could see the total displayed for each one. Can anybody help me on how to achieve this? Thanks. Max use expression-bound DataColumn
look at http://www.ondotnet.com/pub/a/dotnet/2003/05/26/datacolumn_expressions.html?page=last or http://msdn.microsoft.com/msdnmag/issues/07/01/datapoints/default.aspx Petar Repac max wrote: Show quote > > I have a form and 5 textbox bounded to a table, called Listing; this table > contains many records; every textbox bounds to a different column and show > some price (price1, price2, ...price5). I add, update and display the > records just using the binding navigator. > Then I need another textbox that must show the sum of all the 5 prices. This > 'total' field must then be written in a column, called Total, inside the > same table. Obviously I want this value comes automatically, so when I go > through records I could see the total displayed for each one. > Can anybody help me on how to achieve this? > > Thanks. > Max > > > Petar,
That's not really what I need. The example you post concerns datagridview and columns added to a dataset. I need the 'total' columns is displayed on a textbox, and the value is added to the database, in a column called 'Total'. Thanks. Max Show quote "Petar Repac" <petar.repac@replace_with_google_mail_service.com> ha scritto nel messaggio news:%23fFO3i7SHHA.192@TK2MSFTNGP04.phx.gbl... > use expression-bound DataColumn > > look at > http://www.ondotnet.com/pub/a/dotnet/2003/05/26/datacolumn_expressions.html?page=last > or > http://msdn.microsoft.com/msdnmag/issues/07/01/datapoints/default.aspx > > Petar Repac > > max wrote: >> I have a form and 5 textbox bounded to a table, called Listing; this >> table contains many records; every textbox bounds to a different column >> and show some price (price1, price2, ...price5). I add, update and >> display the records just using the binding navigator. >> Then I need another textbox that must show the sum of all the 5 prices. >> This 'total' field must then be written in a column, called Total, inside >> the same table. Obviously I want this value comes automatically, so when >> I go through records I could see the total displayed for each one. >> Can anybody help me on how to achieve this? >> >> Thanks. >> Max >> >> Max,
Have a look at datatable compute, Peter was showing horizontal summing. The compute does vertical summing. http://msdn2.microsoft.com/en-gb/library/system.data.datatable.compute.aspx Cor Show quote "Max" <nobody@devnull.spamcop.net> schreef in bericht news:45cba2f9$0$20804$5fc30a8@news.tiscali.it... > Petar, > That's not really what I need. > The example you post concerns datagridview and columns added to a dataset. > I need the 'total' columns is displayed on a textbox, and the value is > added to the database, in a column called 'Total'. > Thanks. > Max > "Petar Repac" <petar.repac@replace_with_google_mail_service.com> ha > scritto nel messaggio news:%23fFO3i7SHHA.192@TK2MSFTNGP04.phx.gbl... >> use expression-bound DataColumn >> >> look at >> http://www.ondotnet.com/pub/a/dotnet/2003/05/26/datacolumn_expressions.html?page=last >> or >> http://msdn.microsoft.com/msdnmag/issues/07/01/datapoints/default.aspx >> >> Petar Repac >> >> max wrote: >>> I have a form and 5 textbox bounded to a table, called Listing; this >>> table contains many records; every textbox bounds to a different column >>> and show some price (price1, price2, ...price5). I add, update and >>> display the records just using the binding navigator. >>> Then I need another textbox that must show the sum of all the 5 prices. >>> This 'total' field must then be written in a column, called Total, >>> inside the same table. Obviously I want this value comes automatically, >>> so when I go through records I could see the total displayed for each >>> one. >>> Can anybody help me on how to achieve this? >>> >>> Thanks. >>> Max >>> >>> > |
|||||||||||||||||||||||