We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Syncfusion Treeview controls - How to set the maximum length for Treeview Labels?

Hi,

We are using Visual Studio 2005(C#, WINFORMS).
In our project, we are using Syncfusion treeview controls. We are facing one problem with this control. I mean, In treeview, label edit, i need to set the maximum length. It should not allow to enter the chars more than maximum length.

Can you please tell me how can i aschieve this using syncfusion treeview control?

Awaiting for your earliest reply.

Thanks and Regards,

Sekaran


1 Reply

MW Melba Winshia Syncfusion Team May 15, 2008 10:31 AM UTC

Hi Sekaran,

Thank you for your interest in Syncfusion Products

You can validate the text of the label of a node with maximum length by using NodeEditorValidateString event. Please use below code snippet to achieve this:


private void treeViewAdv1_NodeEditorValidateString(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvCancelableEditEventArgs e)
{
//Check for Maximum length
if (e.Label.Length >= 6)
e.Cancel = true;
}


Please refer the sample in the below link which illustrates the above:

http://websamples.syncfusion.com/samples/Tools.Windows/Tools_Windows_TreeviewEdit/main.htm

Please try this and let me know if this helps.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon