在页面关闭事件上调用vb net函数 [英] calling vb net function on page close event

查看:69
本文介绍了在页面关闭事件上调用vb net函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我有一个代码背后的功能如下



 私有  Sub  获取()
Dim test1 作为 字符串
Dim test 作为 字符串
如果 test IsNot 没什么 然后

结束 如果







现在我想打电话给这个( )当用户关闭网页表格时的功能。



请帮助我

解决方案

尝试此活动



 私人 < span class =code-keyword> Sub  Form1_FormClosed(sender  as   Object ,e < span class =code-keyword> as  FormClosedEventArgs)_ 
句柄 Form1.FormClosed

//调用你的func

结束 Sub


用于服务器端页面生命周期功能,你可以这样做。

 私有  Sub  Page_Unload(发件人作为 对象, e  As  System.EventArgs)句柄  .Unload 
' 调用你的函数
结束 Sub





但如果您使用ALT + F4关闭浏览器则无法正常工作。


Hi,


I have one code behind function like below

Private Sub Get()
            Dim test1 As String  
            Dim test As String 
            If test IsNot Nothing Then

                           End If




now i want to call this get() function when user close the web form .

please help me

解决方案

Try with this event

Private Sub Form1_FormClosed(sender as Object, e as FormClosedEventArgs) _ 
     Handles Form1.FormClosed

      //call your func

End Sub


for server side page lifecycle function you can do like this.

Private Sub Page_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
' call your function
    End Sub



but if you close your browser with ALT+F4 it is not going to work.


这篇关于在页面关闭事件上调用vb net函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆