<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno lun 27 gen 2020 alle ore 07:16 Bruce <<a href="mailto:adamnt42@gmail.com">adamnt42@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi folks,<br>
<br>
Is there any way to check or trap that a textarea has just been pasted into?<br>
It's OK for them to type into it, so the Change event doesn't solve my <br>
problem, which is I need to clean up the text that has just been pasted.<br>
<br>
Bruce<br></blockquote><div><br></div><div>I'm not sure I hit the point, see the following code of a TextArea to which you must have to adapted the paste popup menu:<br>------------------------------------------------------------------------------<br>Public Sub TextArea1_KeyPress()<br><br> Dim s As String<br> Dim ss As String[]<br> Dim iStart, iMinus As Integer<br> Dim bExternal As Boolean = True<br><br> If Key.Code = Key["V"] And If Key.Control Then<br> 'Stop<br> Try s = Clipboard.Paste("text/plain;charset=utf-8")<br> If Not s Then<br> Try s = Clipboard.Paste()<br> bExternal = False<br> Endif<br> Stop Event<br> iStart = String.Len(TextArea1.Text) <br> ss = Split(s, "\n")<br> If bExternal Then<br> iMinus = ss.Max<br> Else<br> iMinus = 0<br> Endif<br> TextArea1.Text &= s<br> TextArea1.Select(iStart, String.Len(s) - iMinus)<br> Endif<br>Catch<br> Print Error.Text<br><br>End<br>-------------------------------------------------------------------------------<br><br>Regards<br>Gianluigi <br></div></div></div>