There may be times when you need to work with the text of an object in a particular format, but do not wish to change the settings of any of the masking properties (ClipMode, DataModeor DisplayMode). For example, if you want to retrieve the text of an object with all literals and prompt characters intact, but don't want to change the way data will be sent to the the database and don't want to use the clipboard. This is the purpose of the GetText method.
GetText returns a string value, containing the text of the object, in the format you specify. When you invoke the GetText method, you pass it a maskmode parameter that determines how the object's text will be returned. This gives you the ability to bypass the settings of the object's masking properties and determine on an ad hoc basis whether to use prompt characters, literals or just the raw text the user has entered.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinMaskedEdit Private Sub UltraMaskedEdit1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ultraMaskedEdit1.ValueChanged ' ValueChanged gets fired whenever value inside the masked edit changes. ' Following code prints out the current value in the masked edit. If the value ' is invalid, then it prints out the text. If Me.UltraMaskedEdit1.IsFullyInput Then Debug.WriteLine("ValueChanged: Valid Value. Value = " & Me.ultraMaskedEdit1.Value.ToString()) Else Debug.WriteLine("ValueChanged: Invalid Value. Text = " & Me.ultraMaskedEdit1.GetText(MaskMode.IncludeBoth)) End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinMaskedEdit; using System.Diagnostics; private void ultraMaskedEdit1_ValueChanged(object sender, System.EventArgs e) { // ValueChanged gets fired whenever value inside the masked edit changes. // Following code prints out the current value in the masked edit. If the value // is invalid, then it prints out the text. if ( this.ultraMaskedEdit1.IsFullyInput ) { Debug.WriteLine( "ValueChanged: Valid Value. Value = " + this.ultraMaskedEdit1.Value.ToString( ) ); } else { Debug.WriteLine( "ValueChanged: Invalid Value. Text = " + this.ultraMaskedEdit1.GetText( MaskMode.IncludeBoth ) ); } }
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