Version

RetainFocus Property

Set this to true to force the masked edit to retain the focus when the user tries to change the focus to a different control when the entered text does not satisify the mask. Set it to false to alter this default behaviour.
Syntax
'Declaration
 
Public Property RetainFocus As Boolean
public bool RetainFocus {get; set;}
Example
Follwoing code shows properties available in MaskValidationError event of the masked edit.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinMaskedEdit

  Private Sub UltraMaskedEdit1_MaskValidationError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinMaskedEdit.MaskValidationErrorEventArgs) Handles ultraMaskedEdit1.MaskValidationError
      ' MaskValidationError gets fired when the user tries to move the focus away from the
      ' masked edit while the masked edit has an invalid input.

      Debug.WriteLine("MaskValidationError fired.")

      If Not e.Message Is Nothing Then
          Debug.WriteLine("Error message = " & e.Message)
      End If

      ' Set the Beep to false to prevent the masked edit from beeping which it does
      ' by default.
      e.Beep = False

      ' Set the RetainFocus to false to prevent it from retaining focus which it does
      ' by default.
      e.RetainFocus = False
  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinMaskedEdit;
using System.Diagnostics;

private void ultraMaskedEdit1_MaskValidationError(object sender, Infragistics.Win.UltraWinMaskedEdit.MaskValidationErrorEventArgs e)
{
	// MaskValidationError gets fired when the user tries to move the focus away from the
	// masked edit while the masked edit has an invalid input.

	Debug.WriteLine( "MaskValidationError fired." );

	if ( null != e.Message )
	{
		Debug.WriteLine( "Error message = " + e.Message );
	}

	// Set the Beep to false to prevent the masked edit from beeping which it does
	// by default.
	e.Beep = false;
	
	// Set the RetainFocus to false to prevent it from retaining focus which it does
	// by default.
	e.RetainFocus = false;
}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also