以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  禁止关闭窗口没有起作用  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=157468)

--  作者:tld
--  发布时间:2020/10/17 8:56:00
--  禁止关闭窗口没有起作用
老师,在窗口 的  beforeclose 事件中,下面代码的功能是当点击yes的时候,禁止关闭窗口。但是没有起到作用,窗口依然被关闭。请老师给看看是什么问题?谢谢!

For Each dr As DataRow In DataTables(e.Form.name & "_table4").dataRows
    If dr.RowState <> DataRowstate.unchanged Then
        Dim Result As DialogResult
        Result = MessageBox.Show("上表中有未保存的行 , 请确认是否需要处理 ?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If Result = DialogResult.Yes Then
            e.Cancel = True
        End If
        
    End If
Next


--  作者:有点蓝
--  发布时间:2020/10/17 9:03:00
--  
……
       If Result = DialogResult.Yes Then
            e.Cancel = True
return
        End If