This is a migrated thread and some comments may be shown as answers.

Make a textbox act like Excell Cell

3 Answers 85 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Vuyiswa
Top achievements
Rank 2
Vuyiswa asked on 09 Jul 2012, 05:30 PM
Hi All 


i am converting an Excell spreadsheet into an application. So i am doing automatic calculations like Excell do , for some  of the cells(textbox) should allow a user to enter the minus sign "-" , and this automatically minus value entered. So my issue here is if th the users enters that character it breaks my app's calculations. Does anyone have any idea how to bypass this ?


Thanks 

3 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 09 Jul 2012, 10:23 PM
Hi Vuyiswa,

Could you provide a little more info on how it breaks and what control you are using? There are a couple things I can mention off the top of my head that should point you in the right direction.

First, I would use a RadMaskedNumericInput control. Next, I would make sure that your logic can accept a negative value. Simply putting a "-" symbol in front of a number won't automatically tell your logic that it is a less-than-zero value until you cast it into an integer properly. 

For instance, to make sure that your value is correct, you can use a regex to strip out the character "-", and then apply this to make it a negative integer.  

myInt = myInt * -1;

This may be a little overboard or I am making it more complicated than it needs to be, but you can just create a method that will handle all the cells in your spreadsheet.

One last thing, do you have to make your own spreadsheet? If not, then you can use RadGridView and accomplish the same functionality as an Excel program.

Good Luck,
Lancelot
0
Petar Mladenov
Telerik team
answered on 12 Jul 2012, 07:48 AM
Hi Vuyiswa ,

 We had an issue with the minus sign in Q2 2012 Official Release. It is logged in our PITS. However, the good news is that it is already resolved. Could you please test your app with the latest internal build and let us know if your issues are resolved ? Thank you in advance.

All the best,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Vuyiswa
Top achievements
Rank 2
answered on 13 Jul 2012, 11:08 AM
Good Day 

I was able to Solve my problem easly. 

What i did i allowed a user to enter the "-" sign and the calculation is wrapped in brackets (BODMAS)

thanks 
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Vuyiswa
Top achievements
Rank 2
Answers by
Lancelot
Top achievements
Rank 1
Petar Mladenov
Telerik team
Vuyiswa
Top achievements
Rank 2
Share this question
or