473,715 Members | 6,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid does not accept comma's

Hello,
Here is the scenario:
I have a datagrid on a winform and a datatable is set as its
datasource. I have added DataGridTableSt yle in datagrid's TableStyles
property. Some of Gridstyles are numeric (doubles) and I have set their
format to #,0.0000 since I want to display the values to comma seperated
(at thousands) and till four decimal places. User can also edit values
in the grid. So far so good.

The Problem:
Edited cell value reverts back to the previous value when the user
enters a comma formatted value. For example: original value was 52.0000
and user entered 1,000,000. IMO i should be displayed as 1,000,000.0000
but the value reverts back to 52.0000. I have tried to consume
CurrentCellChan ged event of datagrid and also RowChanging/ColumnChanging
events.
- CurrentCellChan ged event does not give me the new value from the
CurrencyManager .
- RowChanging/ColumnChanging events do not raise at all in the above
mentioned scenario.

Any thoughts/workarounds?

TIA.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #1
3 2808
Maqsood,

Are you using DataGridColumnS tyles

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor
Nov 17 '05 #2
Hello,
Yes I am using the DataGridColumnS tyles (DataGridTextBo xColumn). I have
associated double with the DataGridTextBox Column and set its format to
"#,0.0000". Actual problem is that it does not accept formatted input.
It works fine otherwise.

TIA
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #3
Ahmed,

I can do the behaviour you describe when I use the "c" format and don't
delete the currency sign.

With this it goes in my opinion fine.

\\
DataTable dt = new DataTable();
dt.Columns.Add( "decimal",Type. GetType("System .Double"));
dt.LoadDataRow( new Object[] { 111111.11 }, true);
dataGrid1.DataS ource = dt;
DataGridTableSt yle ts = new DataGridTableSt yle();
ts.MappingName = dt.TableName;
DataGridTextBox Column tb = new DataGridTextBox Column();
tb.MappingName = "decimal";
tb.Format = "d";
ts.GridColumnSt yles.Add(tb);
dataGrid1.Table Styles.Add(ts);
///

I hope this helps,

Cor

"Maqsood Ahmed" <ma***********@ gmail.com> schreef in bericht
news:Oa******** ******@TK2MSFTN GP15.phx.gbl...
Hello,
Yes I am using the DataGridColumnS tyles (DataGridTextBo xColumn). I have
associated double with the DataGridTextBox Column and set its format to
"#,0.0000". Actual problem is that it does not accept formatted input.
It works fine otherwise.

TIA
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net

*** Sent via Developersdex http://www.developersdex.com ***

Nov 17 '05 #4

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

Similar topics

7
4673
by: Matthew Wieder | last post by:
Hi - I have a datagrid that has a black header and the rows alternate white and gray. The problem is that until items are added to the grid, the grid appears as a large black rectangle, which is quite ugly. The black area is larger then it is once an item is added. How can I solve this problem either by: A) Having only the header black and the rest of the empty block white or gray (preffered solution) B) Having the color gray or white...
5
4562
by: cwbp17 | last post by:
Hi all, Have a datagrid that displays the price column of a table. Went to the Datagrid's Property builder and set the 'Data Formatting expression' for the PRICE column to {0:c}, so that the dollar sign, the comma, and the decimal are included (i.e. $44,644.48) Managed to update the price column of the datagrid back to the database, as long as, the user doesn't delete the dollar sign (in the 0 position).
0
1221
by: Jeremiah Adams | last post by:
I am having two issues with the Datagrid and I hope that someone can help me out with them. 1) Printing. I pulled the code for sending the control to a printer off the msdn site. It works for the most part but will not print all the information contained in the control. For example, If the datagrid contains enough rows that the scroll bars become active and a user has to scroll down to display all the data the controll will only print...
1
5310
by: nate axtell | last post by:
In VB .NET I load the contents of an Excel or comma seperated values file into a dataGrid (via a datatable). One of the columns has a comma in the name of the column. So for the comma separated values files I put double quotes are the column name. What I see is that the name ends up getting displayed correctly in the DataGrid column, "Class (1,2,3)". When I click on the column to sort I see the following error: "Additional information:...
4
7626
by: Peter | last post by:
(VS 2003) I have a DataGrid and accept button. My problem is when a user starts to edit one of the values in the grid and does not either press Enter or move of the current cell and presses the Accept buton the current typed value does not get passed into the grid, but stays in the edit mode. How can I move the current edit value into the grid without requireing user to press Enter or move to a different cell? Thanks
7
2511
by: rn5a | last post by:
The first column of a DataGrid has a CheckBox for all the rows. I want that when users check a CheckBox, the BackColor of that entire row in the DataGrid should change to a different color. To implement this, if I am not mistaken, I HAVE TO post the Form first i.e. set the AutoPostBack property of the CheckBox to True. Without posting the Form, I don't think the BackColor of the checked row can be changed using ASP.NET, isn't it? Of...
0
1795
by: rn5a | last post by:
All the rows in a DataGrid are accompanied by a CheckBox. When a user checks the rows & clicks a Button, the checked rows get deleted. For e.g. assume that the DataGrid displays 10 rows. A user checks the rows 2, 4, 6, 8 & 10. When he clicks the Button, the page posts & the next page displays only 5 rows i.e. row 1, 3, 5, 7 & 9. The checked rows are populated in a ViewState variable & will have values like 2, 4, 6, 8, 10, (note that there...
1
2036
by: hygum | last post by:
I've found a useful script that only accepts numbers and a point, and 3 decimals, in an input. But here in denmark we normally use comma as decimal delimiter in numbers, not the point (.) as in english-speaking countries. Can somebody help me making this javascript accept comma as delimiter in the input? I'm thinking that the best solution is that the script converts comma to a point, when the user input a comma. ...
3
2558
by: Brock | last post by:
I am trying to populate a Crystal Report from data in my DataGrid. The reason for this is that I want the user to be able to change values without updating the database, but still have their report reflect the values they anticipate committing to see hypothetical totals of columns from a set of records. These records are displaying properly on my DataGrid but I'm not sure how to get Crystal Reports 10 to use as its datasource the dataset...
0
8823
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9343
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9104
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6646
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5967
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2541
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2119
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.