Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
textchanged事件上的自定义ASP.NET文本框_Asp.net_Vb.net_Asp.net Ajax - Fatal编程技术网

textchanged事件上的自定义ASP.NET文本框

textchanged事件上的自定义ASP.NET文本框,asp.net,vb.net,asp.net-ajax,Asp.net,Vb.net,Asp.net Ajax,我想让TextBox控件TextChanged事件仅在TextBox中有多个字符时触发 谢谢。我认为您需要一个自定义控件,该控件通过自定义事件继承textbox控件,在内部事件中进行检查,并在您认为合适时触发自定义事件 Public Class ZTextBox Inherits System.Windows.Forms.TextBox Public Event ZTextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

我想让TextBox控件TextChanged事件仅在TextBox中有多个字符时触发


谢谢。

我认为您需要一个自定义控件,该控件通过自定义事件继承textbox控件,在内部事件中进行检查,并在您认为合适时触发自定义事件

Public Class ZTextBox
Inherits System.Windows.Forms.TextBox
Public Event ZTextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    MyBase.OnPaint(e)

    'Add your custom paint code here
End Sub

Private Sub ZTextBox_TextChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
    If Me.Text.Length > 3 Then
        RaiseEvent ZTextChanged(sender, e)
    End If
End Sub End Class
您可以在表单中使用以下内容

    Private Sub ZTextBox1_ZTextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ZTextBox1.ZTextChanged
    MsgBox(1)
End Sub