You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Hello Jing,
Is there a MaxLenght method for the cells? or will i have inherit the reogridcell and add it myself? or i can do this.. can add to the celltextchanged event? if do that will impact performance?
Thank you,
shane
Offline
Hi Shane, for different cases there could be several ways that cell text can be changed. Directly input is one of that, copying and pasting should also be checked, same to the dragging mouse to copy/move cells data.
If you just allow your users to simply edit on the worksheet, the following code that limits the max length to 5 chars may work for you.
Dim sheet = ReoGridControl1.CurrentWorksheet
AddHandler sheet.CellEditCharInputed, Sub(s, ea)
If sheet.IsEditing Then
If sheet.CellEditText.Length > 5 AndAlso ea.InputChar <> 8 Then
ea.InputChar = 0
End If
End If
End Sub
Where ea.InputChar <> 8 is used to detect the Backspace input in order to deleting text, which will be performed by ReoGrid core so that we don't need to check it from future versions.
Last edited by Jingwood (2016-03-02 03:13:10)
Offline
Hello Jing,
Ok.. I will try this and get back to you, Thank you
Shane
Offline