Make a textbox act like Excell Cell

4 posts, 0 answers
  1. Vuyiswa
    Vuyiswa avatar
    188 posts
    Member since:
    Jan 2010

    Posted 09 Jul 2012 Link to this post

    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 ?

  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 09 Jul 2012 Link to this post

    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,
  3. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 12 Jul 2012 Link to this post

    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 >>

  4. Vuyiswa
    Vuyiswa avatar
    188 posts
    Member since:
    Jan 2010

    Posted 13 Jul 2012 Link to this post

    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)

Back to Top