We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Single data type question?

We just started doing calculations on grid fields and noticed some problems. If we have a currency cell set up with its cellvaluetype = system.single that it will only hold a number with 7 digits in it. If you go over 7 digits in ur cell then move off the cell it thinks awhile like its confused and then when it finally does move to the next cell it puts a zero in the cell that u just entered over 7 digits in. so in this sample..i have 2 columns set up. the first colums allows the user to enter 9 currency number digits with a type of system.single. in the second coulmn the user can enter a max of 7 currency number digits also with system.single. Try and enter 999999999 in column one row one and click off that cell and watch it pause and think then change it to zero. do the same for column 2 row one but only enter 9999999 and then when u click another cell u will see it immediatly move to the other cell and leave the 7 nines in the cell. now if u click back on row one column one u will see 109 or i am guessing 1.0E+9. This works with system.decimal just fine but we were trying to be more effecient and not use any bigger types then we knew we would ever need. I am attaching a sample. I also noticed a forum article 9652 where u talking about setting this cellvaluetype in the code but u do it in C. we cant set this variable to anything at all in VB without it erroring out. Thanx Phil currency calculate_8323.zip

1 Reply

AD Administrator Syncfusion Team February 2, 2004 10:26 PM UTC

If you want to be able to enter nine 9''s in a Currency cell, then you will have to choose a datatype that allows this number of digits. So, you would have to use either double or decimal. You cannot use single. The reason is that every digit in a currency cell is significant. Singles only supports 6-7 significant digits. You could use a single and set the cell type to TextBox, set the CellValueType to Single, and set teh MaxLength = 9.

Loader.
Up arrow icon