KeyPress Problem

Posted by: sandipan on 8 September 2017, 1:45 pm EST

  • Posted 8 September 2017, 1:45 pm EST

    Hi


    I am using Farpoint Speread for Win Forms 4. I am having a Keypress validation that when the user types a value in the cell The value can be in format


    "Serial: " .


     for example values can be Serial 1, Serial 2, etc


    Now in the validation , when the user presses key , i don't want the word 'Serial' to be removed. In other word , if the backspace is applied on a on "Serial 123" then it should work until "Serial", but once only "Serial" is left , I do not want the back space key to remove anything.


    Can anybody show me how to do it from the Key Press Handler. Some code would be appreciated


    Thanks


     Sandipan


     

  • Replied 8 September 2017, 1:45 pm EST

    Sandipan.


    How about using a MaskCellType. Then you do not have to set up a Key event to monitor keystrokes.


    Dim m As New FarPoint.Win.Spread.CellType.MaskCellType


    m.Mask = "SERI\A\L: #####"


    m.MaskChar = " "


    FpSpread1.Sheets(0).Cells(1, 1).CellType = m

  • Replied 8 September 2017, 1:45 pm EST

    One way to accomplish this that you may not have considered is the MaskcellType

     

            Dim cbc As New MaskCellType
            cbc.Mask = "Serial: #"
            FpSpread1.ActiveSheet.Cells(1, 1).CellType = cbc

     

     

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels