Compartilhar via


IXRTextBox::GetMaxLength (Compact 2013)

3/28/2014

This method retrieves the value that determines the maximum number of characters allowed for user input.

Syntax

virtual HRESULT STDMETHODCALLTYPE GetMaxLength(
    int* pMaxLength
) = 0;

Parameters

  • pMaxLength
    [out] Pointer to an integer value that indicates the maximum number of characters allowed for user input.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

If pMaxLength is 0, it indicates that there is no restriction on the number of characters.

pMaxLength only restricts the number of characters that a user can input. It does not restrict the programmatic input. If the number of characters programmatically added to the text box is greater than the value of pMaxLength, then the user can delete characters, but not add any. As soon as the number of characters is less than pMaxLength, the user can add text again.

The user is able to undo previous actions and cause the text to exceed the value of pMaxLength.

If the user pastes text into the text box that causes the number of characters to exceed pMaxLength, then the last characters in the text box are deleted.

Surrogate characters are treated as one character for the purposes of determining text length. For more information about surrogate characters, see this Web site.

.NET Framework Equivalent

System.Windows.Controls.TextBox.MaxLength

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRTextBox
IXRTextBox::SetMaxLength