如何在变量值改变时触发事件 VB.NET
1个回答
展开全部
'vb.net2008
Public Class Form1
Public y_change, y_0 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
y_change = Nothing : y_0 = Nothing
Timer1.Interval = 100
Timer1.Enabled = True
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
y_change = TextBox1.Text
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
If y_change <> y_0 Then
MsgBox("变量值改变") '变量值改变时触发事件
y_0 = y_change
End If
Timer1.Enabled = True
End Sub
End Class
Public Class Form1
Public y_change, y_0 As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
y_change = Nothing : y_0 = Nothing
Timer1.Interval = 100
Timer1.Enabled = True
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
y_change = TextBox1.Text
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
If y_change <> y_0 Then
MsgBox("变量值改变") '变量值改变时触发事件
y_0 = y_change
End If
Timer1.Enabled = True
End Sub
End Class
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询