|
-
Jan 11th, 2002, 06:02 PM
#1
Thread Starter
New Member
textbox selstart
Hey,
I've written a subroutine to disable pasting in a textbox, by checking whats just gone into the textbox against what's in the clipboard...
Private sub txtSuppSurn_Change()
Call disablepaste(txtSuppSurn)
End Sub
And in a module
Public Sub disablepaste(box As textbox)
Dim position As Integer
position = box.SelStart
If box.SelStart - Len(Clipboard.GetText) >= 0 Then
box.SelStart = box.SelStart - Len(Clipboard.GetText)
box.SelLength = Len(Clipboard.GetText)
If box.SelText = Clipboard.GetText Then box.SelText = "" Else box.SelStart = position
box.SetFocus
End If
End Sub
Fine, works grand, but i've got a small bonus feature (error) like this: if the lenght of the textbox is above about 8,9 or 10 chars, it looks like the start of the string is chopped off.
It isn't, the textbox has scrolled along... since this is all supposed to be invisible, that's not good... any ideas? I'd like to keep the processing more or less the same way, so i can selectively disable the pasting etc...
Cheers
Des
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|