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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to highlight the error line in Edit control?

Platform: WinForms |
Control: EditControl

Edit control supports to highlight the error lines. It can be achieved using below functions,


RegisterUnderlineFormat: Used to set custom underline format. It contains the below parameter.


  1. Color:  Used to set the underline custom color.


  1. UnderlineStyle:  Used to set the Style of the underlining, like as Dash, DashDot, Dot, Solid, Wave.


  1. UnderlineWeight: Used to set the Weight of the underlining like as Bold, Double, Double Bold, Thin.


SetUnderline: Used to set the underline in specified text region.


RemoveUnderLine: Used to remove the underline in specified region.


The following code demonstrates same.



ISnippetFormat format;
format = editControl1.RegisterUnderlineFormat(Color.Red, Syncfusion.Windows.Forms.Edit.Enums.UnderlineStyle.Solid, Syncfusion.Windows.Forms.Edit.Enums.UnderlineWeight.Bold);
// To draw underline                     
       this.editControl1.SetUnderline(this.editControl1.Selection.Top, this.editControl1.Selection.Bottom, format);                  
// To remove underline
this.editControl1.RemoveUnderline(this.editControl1.Selection.Top, this.editControl1.Selection.Bottom);



ISnippetFormat format
format = editControl1.RegisterUnderlineFormat(Color.Red, Syncfusion.Windows.Forms.Edit.Enums.UnderlineStyle.Solid, Syncfusion.Windows.Forms.Edit.Enums.UnderlineWeight.Bold)
' To draw underline
     Me.editControl1.SetUnderline(Me.editControl1.Selection.Top,Me.editControl1.Selection.Bottom, format)
' To remove the selection




Showing error line


Sample Links:


C#: EditControlErrorHighlight

VB: EditControlErrorHighlight

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile