请问怎样在粘贴字符到TextBox前进行判断,字符是否符合?

如题
---------------------------------------------------------------

Dim getDate As New DataObject
Dim ss As String
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
getDate = System.Windows.Forms.Clipboard.GetDataObject()
Try
ss = getDate.GetData(DataFormats.Text)
If ss Is Nothing Then
Else '说明里面是字符串,然后判断
'写要判断的函数,
End If

Me.TextBox1.Text = ss
Catch ex As Exception
End Try
End Sub
或:
Private Sub TextBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseUp
getDate = System.Windows.Forms.Clipboard.GetDataObject()
Try
ss = getDate.GetData(DataFormats.Text)
If ss Is Nothing Then
Else '说明里面是字符串,然后判断
'写要判断的函数
End If

Me.TextBox1.Text = ss
Catch ex As Exception
End Try
End Sub

Published At
Categories with Web编程
Tagged with
comments powered by Disqus