在方法调用按钮中单击事件 [英] In Method call button click Event
本文介绍了在方法调用按钮中单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在方法中,调用按钮单击事件。例如
Hi,
In Method, call Button click Event. For Example
Private Function fn()
'call button click event.
End Function
请帮帮我。
问候
Rajesh V
Help me out please.
Regards
Rajesh V
推荐答案
从控件外部调用控件事件不是一个好的编程习惯。更好地创建这样的东西(假设你的按钮是例如保存文件):
It is not a good programming practice to call events of controls from outside of the control. Better create something like this (Assuming your button is e.g. saving a document):
'Click event of a button named "SaveButton"
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles SaveButton.Click
Call SaveDocument()
End Sub
'Function which actually saves the document
Private Function SaveDocument()
' Add saving logic here
End Function
'Your function
Private Function fn()
Call SaveDocument()
End Function
希望它可以帮到你!
欢呼,
Marco Bertschi
Hope it helps you!
cheers,
Marco Bertschi
这篇关于在方法调用按钮中单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文