biv
biv

Reputation: 1673

MaskedTextBox multiline asciionly

When

MaskedTextBox srcCodeBox = new MaskedTextBox();
srcCodeBox.AsciiOnly = true;
srcCodeBox.Multiline = true;

Multiline not works.

Why?

Upvotes: 1

Views: 600

Answers (1)

Yeldar Kurmangaliyev
Yeldar Kurmangaliyev

Reputation: 34244

The answer is pretty simple - it should not work.

  1. MaskedTextBox is not supposed to be multiline.
    According to MSDN, MaskedTextBox.MultiLine property

    Gets or sets a value indicating whether this is a multiline text box control. This property is not fully supported by MaskedTextBox.

    However, it is not a main problem.

  2. AsciiOnly property disables multiline behaviour because allows only English alphabet letters.

    According to MSDN, MaskedTextBox.AsciiOnly property

    If true, AsciiOnly restricts user input to the characters a-z and A-Z. ASCII control characters are not allowed.

    Newline (line break) is an ASCII control character. In other words, MultiLine will not work with AsciiOnly even for a simple TextBox control.

Upvotes: 3

Related Questions