检测变量。 [英] Detecting Variable Changes.
问题描述
如何检测变量是否发生变化。
我的意思是这样用于标签。
Private Sub Label1_TextChanged(sender As Object,e As EventArgs)Handles Label1.TextChanged
End Sub
Can一个类似的代码适用于变量?
我基本上需要一个Label来显示Var值。 MyLabel.text = MyVar.ToString
怎么能我检测到是否发生了变量变化。
我的意思是这样用于标签。
Private Sub Label1_TextChanged(sender As Object,e As EventArgs)Handles Label1.TextChanged
End Sub
类似的代码可以用于变量吗?
您可以创建一个私人活动,然后订阅该活动,但您需要在该代码中提升该活动的每个地方都是您现在需要查看的地方。
我的意思是:这是你的代码,所以你知道可以改变的每个地方,对吗?
How can I detect if a Variable change occurs.
I mean something like this used for Labels.
Private Sub Label1_TextChanged(sender As Object, e As EventArgs) Handles Label1.TextChanged End Sub
Can a similar code work for a Variable?
I basically need a Label to show me the Var value. MyLabel.text = MyVar.ToString
How can I detect if a Variable change occurs.
I mean something like this used for Labels.
Private Sub Label1_TextChanged(sender As Object, e As EventArgs) Handles Label1.TextChanged End SubCan a similar code work for a Variable?
You could create a private event and then subscribe to that event, but every place in your code where you need to raise that event is where you need to be looking now.
What I mean is: It's your code, so you know every place that it could change, right?
这篇关于检测变量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!