以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  大家帮我看一下这个退出系统的按钮有什么问题啊!!!  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=51800)

--  作者:洗衣粉
--  发布时间:2014/6/3 19:15:00
--  大家帮我看一下这个退出系统的按钮有什么问题啊!!!
For Each dt As DataTable In DataTables
    If dt.HasChanges Then
        If MessageBox.Show("数据已修改,是否保存?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information) = DialogResult.Yes Then
            Syscmd.Project.Exit(True)
        Else If MessageBox.Show("数据已修改,是否保存?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information) = DialogResult.No Then
            DataTables.RejectChanges
        Else If MessageBox.Show("数据已修改,是否保存?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information) = DialogResult.Cancel Then
            Syscmd.Edit.Undo()
        End If
    Else
        If MessageBox.Show("确认退出吗?","请确认!",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) = DialogResult.OK Then
            Syscmd.Project.Exit()
        Else
            Syscmd.Edit.Undo()
        End If
    End If
Next

大家帮我看一下这个退出系统的按钮有什么问题啊,弄半天都不知道怎么调!!!

--  作者:有点甜
--  发布时间:2014/6/3 19:30:00
--  

代码

 

For Each dt As DataTable In DataTables
    If dt.HasChanges Then
        Dim result As Object = MessageBox.Show("数据已修改,是否保存?","提示",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information)
        If result = DialogResult.Yes Then
            DataTables.Save
        Else If result = DialogResult.No Then
            DataTables.RejectChanges
        Else If result = DialogResult.Cancel Then
            Syscmd.Edit.Undo()
        End If
        Exit For
    End If
Next

If MessageBox.Show("确认退出吗?","请确认!",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) = DialogResult.OK Then
    Syscmd.Project.Exit()
Else
    Syscmd.Edit.Undo()
End If

[此贴子已经被作者于2014-6-3 19:30:27编辑过]

--  作者:洗衣粉
--  发布时间:2014/6/3 20:43:00
--  
好,谢谢啊