Foxtable(狐表)用户栏目专家坐堂 → 关于退出窗体


  共有1774人关注过本帖树形打印复制链接

主题:关于退出窗体

帅哥哟,离线,有人找我吗?
peibaomin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:465 积分:3216 威望:0 精华:0 注册:2017/4/18 1:15:00
关于退出窗体  发帖心情 Post By:2017/6/18 19:35:00 [只看该作者]

For Each dt As DataTable In DataTables
    If dt.HasChanges Then
        Dim Result As DialogResult
        Result = MessageBox.Show("窗体处于编辑状态,是否放弃编辑退出?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
        If Result = DialogResult.No Then
            jinzhihangjianyidong= False
            Exit For
        ElseIf result = DialogResult.Cancel Then
            Tables("机具库存资料").Current("机具条码") = e.Form.Controls("jijutiaomatext1").Value
            Tables("机具库存资料").Current("所属仓库") = e.Form.Controls("suoshucangkuCombo").Value
            Tables("机具库存资料").Current("客户姓名") = e.Form.Controls("kehuxingmingCombo").Value
            Tables("机具库存资料").Current("机具型号") = e.Form.Controls("jijuxinghaoCombo").Value
            Tables("机具库存资料").Current("机具类型") = e.Form.Controls("jijuleixingCombo ").Value
            Tables("机具库存资料").Current("厂家名称") = e.Form.Controls("changjiaxingmingCombo").Value
            Tables("机具库存资料").Current("机具来源") = e.Form.Controls("jijulaiyuanCombo").Value
            Tables("机具库存资料").Current("机具所属机构") = e.Form.Controls("jijusuoshujigouCombo").Value
            Tables("机具库存资料").Current("机具所属机构负责人") = e.Form.Controls("jijusuoshujigongfuzerenCombo").Value
            Tables("机具库存资料").Current("所属机构级别") = e.Form.Controls("suoshujigoujibieCombo").Value
            DataTables("机具库存资料").save
            jinzhihangjianyidong= True
            Return
        End If
    End If
Next
e.Cancel  =False
jinzhihangjianyidong= True

 

 

 

 

这句代码有为题吗?

我想实现选择“是”选项则执行保存修改的数据后退出窗体,如选择“否”选项则执行不保存修改的数据退出窗体,如选择“取消”选项则执行不保存数据返回原窗体。可运行的时候选“取消”选项也是退出窗体,选“否“选项则保存数据退出窗体,选择'是"选项也是退出窗体整个都乱了!请老师指点指点,谢谢!!


 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/6/18 21:35:00 [只看该作者]

If Tables("机具库存资料").DataTable.HasChanges Then
    Dim Result As DialogResult
    Result = MessageBox.Show("窗体处于编辑状态,是否放弃编辑退出?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
    If Result = DialogResult.No Then
        'jinzhihangjianyidong= False
    ElseIf result = DialogResult.Cancel Then
        e.cancel = True
    ElseIf result = DialogResult.Yes Then
        Tables("机具库存资料").Current("机具条码") = e.Form.Controls("jijutiaomatext1").Value
        Tables("机具库存资料").Current("所属仓库") = e.Form.Controls("suoshucangkuCombo").Value
        Tables("机具库存资料").Current("客户姓名") = e.Form.Controls("kehuxingmingCombo").Value
        Tables("机具库存资料").Current("机具型号") = e.Form.Controls("jijuxinghaoCombo").Value
        Tables("机具库存资料").Current("机具类型") = e.Form.Controls("jijuleixingCombo ").Value
        Tables("机具库存资料").Current("厂家名称") = e.Form.Controls("changjiaxingmingCombo").Value
        Tables("机具库存资料").Current("机具来源") = e.Form.Controls("jijulaiyuanCombo").Value
        Tables("机具库存资料").Current("机具所属机构") = e.Form.Controls("jijusuoshujigouCombo").Value
        Tables("机具库存资料").Current("机具所属机构负责人") = e.Form.Controls("jijusuoshujigongfuzerenCombo").Value
        Tables("机具库存资料").Current("所属机构级别") = e.Form.Controls("suoshujigoujibieCombo").Value
        DataTables("机具库存资料").save
        'jinzhihangjianyidong= True
    End If
End If

 回到顶部