473,402 Members | 2,061 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,402 software developers and data experts.

C# 1.1 DataGrid question

Hi,

In my C# 1.1 windows form project, I have a form Form1 which has a DataGrid
DataGrid1.
In the DataGrid1, I have 3 columns, they are Unit, UnitPrice, TotalPrice.
What I want is in this DataGrid, if a user modify the Unit or UnitPrice,
then the value of the column TotalPrice will respond returning the value of
Unit * UnitPrice, after the user press the button.
I tried in the KeyPress event but I have encountered some problem,
if the Unit origin value is 8 ,and a user typed in 9, the event get the
value 8 , not 9.
What event do I need to use to get the value of 9 or I need to do extra
manipulation in the KeyPress event?
Thanks for help.
Jason
Dec 26 '07 #1
1 1684
hi use this thsi is cell click event when after updating unit or unit price u
will click the row again u will get the updated value

private void dataGridView2_CellClick(object sender,
DataGridViewCellEventArgs e)
{
dataGridView2.Rows[e.RowIndex].Cells[2].Value =
Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[0].Value) *
Convert.ToInt32(dataGridView2.Rows[e.RowIndex].Cells[1].Value);
}

"Jason Huang" wrote:
Hi,

In my C# 1.1 windows form project, I have a form Form1 which has a DataGrid
DataGrid1.
In the DataGrid1, I have 3 columns, they are Unit, UnitPrice, TotalPrice.
What I want is in this DataGrid, if a user modify the Unit or UnitPrice,
then the value of the column TotalPrice will respond returning the value of
Unit * UnitPrice, after the user press the button.
I tried in the KeyPress event but I have encountered some problem,
if the Unit origin value is 8 ,and a user typed in 9, the event get the
value 8 , not 9.
What event do I need to use to get the value of 9 or I need to do extra
manipulation in the KeyPress event?
Thanks for help.
Jason
Dec 26 '07 #2

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

Similar topics

2
by: magister | last post by:
Hello, I have xml like this.... <test> <question>sdfsa</question> <section><question>43ga</question> <question>asdf</question> </test>
2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
2
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of...
4
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a...
13
by: pmcguire | last post by:
I have a DataGrid control for which I have also created several new extended DataGridColumnStyles. They behave pretty nicely, but I can't figure out how to implement Selected Item formatting for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.