473,387 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Doing calculation in a datagrid

I have a datagrid on a windows form and I want to multiply
one column by another and the result in another. For
instance multiplying the price column by the quantity
column and updating the amount column. Sample code would
make me happy. Thanks.
Nov 15 '05 #1
2 2380
One way would be to to set the expression of the column you want the result
in
ei: columnResult.Expression = "column1 + column2);

"Belee" <ba***@siliconpro.net> wrote in message
news:00****************************@phx.gbl...
I have a datagrid on a windows form and I want to multiply
one column by another and the result in another. For
instance multiplying the price column by the quantity
column and updating the amount column. Sample code would
make me happy. Thanks.

Nov 15 '05 #2
Belee wrote:
I have a datagrid on a windows form and I want to multiply
one column by another and the result in another. For
instance multiplying the price column by the quantity
column and updating the amount column. Sample code would
make me happy. Thanks.


The easiest way to do this is to add another column to your DataTable
and set its Expression property to [Field1] * [Field2]. Then you can
just bind another DataGrid column to it.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Aspersion | last post by:
I'm building an ASP page that has a lot of text and graphics. There is a calculation facility on the page. The user enters several numbers in a form and presses a button to see the calculated...
1
by: Benny | last post by:
Hi, I would like to know, if I need to do some floting point operations (mainly multiplication and division) on each roll of a table, should I read the data out from the DB and do the...
0
by: anaxamandr | last post by:
Hi. I have a long loop in ASP that performs a rather lengthy calculation. I would love for my users to be able to stop that calculation, if they so choose, mid way through the process. I attempted...
2
by: Del | last post by:
Thanks in advance for any help. I have a database that was created in Access 2000. Several users have been upgraded to Access 2003. Since upgrading to 2003 we have noticed that some of the...
4
by: Michiel Alsters | last post by:
Hello everybody, I hope anybody can help me. I'll try to give a brief overview of my problem. I have running a program that performs a heavy calculation. To give the user feedback what the...
1
by: Belee | last post by:
I am doing calculation in a data grid and I get the following error message: "Input format not in correct format". The following is the code in c# private void...
2
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
3
by: Lerp | last post by:
Hi all, I am building an app that has a lot of one to many relationships and was curious as to the best method in displaying rows of data from both tables on the same line. ie: row1 of...
1
by: jack | last post by:
Hi, My boss wanted to create a datagrid which should calculate the formulas which is entered in one of the textbox of the grid For example if first textbox in grid is given the name A with the...
3
by: mattmao | last post by:
Okay, I was asked by a friend about the result of this limit: http://bbs.newwise.com/attdata/forumid_14/20070922_fe7f77c81050413a20fbDWYOGm7zeRj3.jpg Not n->zero but n-> + infinite I really...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.