I have a column in an UltraGrid that I want to limit to 4000 characters. I've added code to set the maxLength for the column.
myGrid.DisplayLayout.Bands(0).Columns("TEXT1").MaxLength = 4000
But I'm still able to enter more than 4000.
To try and track this down, I've added an event handler for the Grid's CellChange event to make sure the MaxLength wasn't being reset somewhere else.
As I'm typing into the cell that I want to limit to 4000 characters, the event fires and I run the following:
? ugNote.ActiveCell.Column.MaxLength
And confirm that the maxLength is still 4000. But I can keep typing, long past the 4000th character. I can add code to manually enforce the MaxLength here in the event - but I was hoping to avoid that.
Have I missed something? Do I need to 'turn on' the max length enforcement?
It was a FormattedTextEditor. My bad. Thanks again
Thank you for the quick reply. I don't believe the value is being cleared elsewhere - but I will verify the type of the column and the editor/style.
Oddly enough - this is working for other columns in the grid that have smaller limits.
Are you possibly clearing this value elsewhere, such as in the InitializeLayout? Is the column of type string and is it using the standard editor or Style? I just tried this out with a smaller value (5) and I couldn't type into a string column for anything longer than this. If you're using a Style of, for example, FormattedTextEditor, I don't think that the MaxLength property will be honored because I don't believe that the FormattedTextEditor supports a MaxLength.
-Matt