
03-11-2004, 09:06 AM
|
 |
Centurion
|
|
Join Date: Jun 2003
Location: Milwaukee
Posts: 126
|
|
Ok, Ok... Pardon my thick-thickheadedness; yes, that certainly would happen. Try something like this that I whipped up real quick:
First change the textbox in question to a RichTextBox and set its MaxLength to 1024...
Code:
Private Sub rtbRequirementDescription_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles rtbRequirementDescription.KeyDown
Dim Result As DialogResult
Dim strBuffer As String
Dim stuff As IDataObject = Clipboard.GetDataObject()
If e.Control = True Then
If e.KeyCode = Keys.V Then
e.Handled = True
strBuffer = CType(stuff.GetData(DataFormats.Text), String)
If strBuffer.Length > 1024 Then
Result = MessageBox.Show("Override?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
rtbRequirementDescription.MaxLength = 32768
rtbRequirementDescription.Text = strBuffer
End If
Else
rtbRequirementDescription.Text = strBuffer
End If
End If
End If
End Sub
That should do it. 
|
__________________
"Something there is that doesn't love a wall, That wants it down"
|