Foxtable(狐表)用户栏目专家坐堂 → 保存成功的提示


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

主题:保存成功的提示

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


加好友 发短信
等级:二尾狐 帖子:591 积分:5511 威望:0 精华:0 注册:2012/6/29 19:11:00
保存成功的提示  发帖心情 Post By:2017/5/14 18:15:00 [只看该作者]

以下代码是写在beforesavedatarow事件里的,在保存的时候判断必填项是否都已填写完整,如果不完整给出提示,并定位到这一行;除此以外,我还想当数据已经全部保存以后,给出“保存成功”的提示,如何做才能不是保存一行提示一行呢?

 

With e.DataRow
    If .IsNull("ProcessNo") And .IsNull("SamplePart") And .IsNull("ProcessTeam") And .IsNull("ProcessMachine") And .IsNull("ProcessName") And .IsNull("processDescription") Then    '如果办单号,客户,款号,尺码,颜色都为空,则自动认为是无办单,系统自动删除;
        e.DataRow.Delete
    Else
        If .IsNull("ProcessNo") Then
            Dim Index As Integer
            Index = Tables("MainSchedule.ProcessSchdule").FindRow(e.DataRow) '找出此行的基础信息是有为空的值
            If Index > -1 Then '如果找到此行
                Tables("MainSchedule.ProcessSchdule").Position = Index '将焦点定位到此行
            End If
            msgbox("【序号】不能为空,保存失败")
            e.Cancel = True '取消存盘
        ElseIf .IsNull("SamplePart") Then
            Dim Index As Integer
            Index = Tables("MainSchedule.ProcessSchdule").FindRow(e.DataRow) '找出此行的基础信息是有为空的值
            If Index > -1 Then '如果找到此行
                Tables("MainSchedule.ProcessSchdule").Position = Index '将焦点定位到此行
            End If
            msgbox("【办房部位】不能为空,保存失败")
            e.Cancel = True '取消存盘
        ElseIf .IsNull("ProcessTeam") Then
            Dim Index As Integer
            Index = Tables("MainSchedule.ProcessSchdule").FindRow(e.DataRow) '找出此行的基础信息是有为空的值
            If Index > -1 Then '如果找到此行
                Tables("MainSchedule.ProcessSchdule").Position = Index '将焦点定位到此行
            End If
            msgbox("【办房工艺分配】不能为空,保存失败")
            e.Cancel = True '取消存盘
        ElseIf .IsNull("ProcessMachine") Then
            Dim Index As Integer
            Index = Tables("MainSchedule.ProcessSchdule").FindRow(e.DataRow) '找出此行的基础信息是有为空的值
            If Index > -1 Then '如果找到此行
                Tables("MainSchedule.ProcessSchdule").Position = Index '将焦点定位到此行
            End If
            msgbox("【操作设备】不能为空,保存失败")
            e.Cancel = True '取消存盘
        Else
            Return
        End If
    End If
End With


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


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

1、e.Cancel = True 代码后面,应该跟一句 return,这样才不会重复提示;

 

2、保存提示可以这样写,单独做个保存按钮。

 

Dim dt As DataTable = DataTables("表A")
dt.save
If dt.HasChanges = False Then
    msgbox("保存成功")
Else
    msgbox("保存失败")
End If


 回到顶部