|
I've written a custom textbox which only allows numerical input. I overrid the WndProc method so i could validate the clipboard contents if the user pasted data into the textbox as shown below:
protected override void WndProc(ref Message m) { switch (m.Msg) { case 0x0302: if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) { string paste = Clipboard.GetDataObject().GetData(DataFormats.Text).ToString(); string text = this.Text.Substring(0, this.SelectionStart) + paste + this.Text.Substring(this.SelectionStart + this.SelectionLength);
if (this.IsValid(text)) { base.WndProc(ref m); } } break; default: base.WndProc(ref m); break; } }
The control works fine, the problem is that if i package this up into a dll and the move it to our server for the other developers to use they get an error when they try to add the control to their tool bar. When i tried it i got the same problem, however, if i add a local copy of the dll it works.
The error is something about not being able to open it and to check for missing referenced files, however, the dll only references inbuilt .net dlls.
If i remove the overloaded WndProc method, it works fine, im convinced its a .net security problem, but its just a guess.
Any ideas?
|