way to limit the number of character the user may type for a label

Hi all, I wanna know whether i can restrict a user from entering characters beyond a limit in a label. Using NodeEditorValidating handler will help me to know the length of the text and throw an error messege when the user attempts to enter a character beyond the preset limit. But i feel it would be even better if i can use a property to do this job. Thanks in advance. Regards, Limy

2 Replies

DT Deepa TS Syncfusion Team December 12, 2005 09:27 AM UTC

Hi Limy, You could use the following code snippet in the NodeEditorValidateString event to restrict a user from entering characters beyond a limit in a LabelEditing. private void treeViewAdv1_NodeEditorValidateString(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvCancelableEditEventArgs e) { if(e.Label.Length<=5) e.ContinueEditing=true; else e.Cancel=true; } Please take a look at the attached sample. And let me know if this meets your requirement. Thanks for your patience and interest in Syncfusion products. Regards, Deepa.T.S

NodesLabel.zip


AD Administrator Syncfusion Team December 15, 2005 11:07 AM UTC

Hi Deepa, Its workin fine. Thanks a lot. Regards, Limy

Loader.
Up arrow icon