以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]beforclose  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=122959)

--  作者:blsu33
--  发布时间:2018/8/5 17:14:00
--  [求助]beforclose
老师,
下面代码貌似很简单,但是拦截放到我的系统中各种不成功
Dim e =args(0)
Dim tbname As String="fa0101_fa0101"
Dim Result As DialogResult
If Tables(tbname).Current IsNot Nothing Then
    If Tables(tbname).Current.DataRow.RowState<>DataRowState.Unchanged Then
        \'Result = MessageBox.Show("是否退出?" & vbcrlf & "【是】将退出保存,【否】将退出,【取消】将返回继续编辑?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information)
        Result = MessageBox.Show(e.Form.baseform,"是否退出?" & vbcrlf & "【是】将退出保存,【否】将退出,【取消】将返回继续编辑?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information)
        If Result = DialogResult.Yes Then
            If Tables(tbname).Current("id")="" Then
                e.Cancel=True
            End If
        End If
    Else If Result = DialogResult.Cancel Then
        e.Cancel=True  ‘这块没有拦截成功’
        \'e.Form.baseform.BringToFront
    Else If Result = DialogResult.No Then
        \'e.Form.baseform.BringToFront
        Tables(tbname).AllowEdit=True
        Tables(tbname).Current.Reject‘这块没有撤销成功’
        Tables(tbname).AllowEdit=False
        
    End If
Else
    PopMessage("未发生变化不需要保存!","提示",PopIconEnum.Infomation,2)
    
End If
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:关闭按钮问题.foxdb



--  作者:有点甜
--  发布时间:2018/8/5 20:34:00
--  
Dim e =args(0)
Dim tbname As String="fa0101_fa0101"
Dim Result As DialogResult
If Tables(tbname).Current IsNot Nothing Then
    If Tables(tbname).Current.DataRow.RowState<>DataRowState.Unchanged Then
        \'Result = MessageBox.Show("是否退出?" & vbcrlf & "【是】将退出保存,【否】将退出,【取消】将返回继续编辑?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information)
        Result = MessageBox.Show(e.Form.baseform,"是否退出?" & vbcrlf & "【是】将退出保存,【否】将退出,【取消】将返回继续编辑?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information)
        If Result = DialogResult.Yes Then
            If Tables(tbname).Current("id")="" Then
                e.Cancel=True
            End If
        Else If Result = DialogResult.Cancel Then
            e.Cancel=True  \'这块没有拦截成功\'\'
            \'e.Form.baseform.BringToFront
        Else If Result = DialogResult.No Then
            \'e.Form.baseform.BringToFront
            Tables(tbname).AllowEdit=True
            Tables(tbname).Current.Reject\'这块没有撤销成功\'
            Tables(tbname).AllowEdit=False
           
        End If
    Else
        PopMessage("未发生变化不需要保存!","提示",PopIconEnum.Infomation,2)
    End If
Else
    \'PopMessage("未发生变化不需要保存!","提示",PopIconEnum.Infomation,2)
End If