Version

SpellError Event

Fired when a word typed by the user is misspelled and this component is in SpellCheckingMode.AsYouType mode.
Syntax
'Declaration
 
Public Event SpellError As SpellErrorEventHandler
public event SpellErrorEventHandler SpellError
Event Data

The event handler receives an argument of type SpellErrorEventArgs containing data related to this event. The following SpellErrorEventArgs properties provide information specific to this event.

PropertyDescription
Action Gets or sets the action to be taken with the word in error.
ReplaceWord Gets the sets the word that will replace the incorrectly spelled text if Action is set to SpellErrorAction.Replace.
SpellCheckTarget (Inherited from Infragistics.Win.UltraWinSpellChecker.SpellCheckTargetEventArgs)Gets the object which was spell checked.
SpellingError Gets the Error instance which describes the new error.
Example
This sample shows how to keep a hash table of auto-corrections and automatically correct errors in the UltraSpellChecker.SpellError event.

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.Win.UltraWinSpellChecker

'A hastable of the auto corrections.
'The key is the erroneous word, and the value is the word to replace it with.
Private autoCorrections As Hashtable = New Hashtable()


Private Sub ultraSpellChecker1_SpellError(ByVal sender As Object, ByVal e As SpellErrorEventArgs) _
	Handles ultraSpellChecker1.SpellError

	'If the erroneous word is in the list of auto corrections...
	If (Me.autoCorrections.ContainsKey(e.SpellingError.CheckedWord)) Then

		'Set the action to replace
		e.Action = SpellErrorAction.Replace
		'Set the replacement word
		e.ReplaceWord = Me.autoCorrections(e.SpellingError.CheckedWord)

	End If
End Sub
using Infragistics.Win.UltraWinSpellChecker;

//A hastable of the auto corrections.
//The key is the erroneous word, and the value is the word to replace it with.
private Hashtable autoCorrections = new Hashtable();

private void ultraSpellChecker1_SpellError(object sender, SpellErrorEventArgs e)
{
	//If the erroneous word is in the list of auto corrections...
	if( this.autoCorrections.ContainsKey( e.SpellingError.CheckedWord ) )
	{
		//Set the action to replace
		e.Action = SpellErrorAction.Replace;
		//Set the replacement word
		e.ReplaceWord = (string)this.autoCorrections[ e.SpellingError.CheckedWord ];
	}
}
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