Hi everyone,
I've run into an interesting issue.
I have a single-line custom textbox control on a form. It's multiline property is set to false, and the maxlength is set to 70.
I override the WndProc method within the control on a WM_PASTE message, and call a custom DoPaste message to paste in text from the clipboard.
The text in the clipboard we want to paste (just a string) is 130+ characters.
When we do the following:
((
TextBox)ctrl).Paste(clipboardText);
it pastes the full length of the text in the textbox. The control is databound to a database field with a limit of 70 characters, so even though we see the full length of the text in the textbox, it's not saved in the database.
We haven't modified any other properties of the textbox so it's all still the same as the base text box.
My question is, even though it's a custom control, since the maxlength of the textbox is set to 70, shouldn't it automatically be truncating the string to 70 characters when pasted in the control regardless of what I do in a custom paste method? Or does programmatically doing the pasting supposed to automatically (apparently) override the control's maxlength property?
Thanks!