以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 减少提示次数 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=183156) |
-- 作者:njzwm -- 发布时间:2022/10/26 12:27:00 -- 减少提示次数 项目中有个提示设计,一旦有符合条件的记录就弹出对话框提示,但是操作起来一旦有N个记录满足条件,就有N个提示,这样没必要,如何使得系统就弹出一次提示就结束程序继续往下执行。 If dr1 IsNot Nothing Then Tables("注意事项").filter = "开始提示 = 1" MessageBox.Show("有任务已经开始!", "提示", MessageBoxButtons.OK, MessageBoxIcon.information) End If
|
-- 作者:有点蓝 -- 发布时间:2022/10/26 13:32:00 -- 在什么事件写代码?完整代码打开发上来 |
-- 作者:njzwm -- 发布时间:2022/10/26 14:27:00 -- 1、窗口afterload事件: Dim dr1 As DataRow = DataTables("注意事项").Find("提示 = 2 ") Dim dr3 As DataRow = DataTables("注意事项").Find("开始提示 = 1") \'System.Threading.Thread.Sleep(8000) ‘暂停8秒 If dr3 IsNot Nothing Then Tables("注意事项").filter = "开始提示 = 1 And 完成 = False" MessageBox.Show("有任务已经开始!", "提示", MessageBoxButtons.OK, MessageBoxIcon.information) End If If dr1 IsNot Nothing Then Tables("注意事项").filter = "提示 = 2 And 完成 = False" MessageBox.Show("有任务即将到期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information) End If Dim dr2 As DataRow = DataTables("注意事项").Find("提示 = 3 And 完成 = False") If dr2 IsNot Nothing Then Tables("注意事项").filter = "提示 = 3 And 完成 = False" MessageBox.Show("有任务已经过期!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning) End If 2、还有就是Button Click事件: Dim dr1 As DataRow = DataTables("注意事项").Find("提示 = 2 ") Dim dr3 As DataRow = DataTables("注意事项").Find("开始提示 = 1") If dr3 IsNot Nothing Then Tables("注意事项").filter = "开始提示 = 1" MessageBox.Show("有任务已经开始!", "提示", MessageBoxButtons.OK, MessageBoxIcon.information) End If If dr1 IsNot Nothing Then Tables("注意事项").filter = "提示 = 2" MessageBox.Show("有任务即将到期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information) End If Dim dr2 As DataRow = DataTables("注意事项").Find("提示 = 3 And 完成 = False") If dr2 IsNot Nothing Then Tables("注意事项").filter = "提示 = 3 And 完成 = False" MessageBox.Show("有任务已经过期!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning) End If Tables("注意事项").filter = "" Tables("注意事项").sort = "排序用,结束日期" -------- 都是这种情况,重复几次弹窗。 |
-- 作者:有点蓝 -- 发布时间:2022/10/26 14:35:00 -- 如果不想执行后面的代码,退出即可 If dr3 IsNot Nothing Then Tables("注意事项").filter = "开始提示 = 1 And 完成 = False" MessageBox.Show("有任务已经开始!", "提示", MessageBoxButtons.OK, MessageBoxIcon.information) return End If |
-- 作者:njzwm -- 发布时间:2022/10/26 14:58:00 -- 我的诉求是下面d3这段代码(绿色代码)要求符合这个条件的弹窗只弹出一次即可,再往下其他的条件的语句还是要继续执行下去的,不是终止。我不用filter用find好像可以解决,我再去试试。 另外还有类似的问题,就是像 for i= 1 to n 这样的循环,如何跳出循环往下继续执行代码,就像那种”exit, 或者 break”语句跳出循环应该怎么写? [此贴子已经被作者于2022/10/26 15:07:02编辑过]
|
-- 作者:有点蓝 -- 发布时间:2022/10/26 15:05:00 -- 加一个变量控制 dim s as boolean If dr3 IsNot Nothing Then Tables("注意事项").filter = "开始提示 = 1 And 完成 = False" MessageBox.Show("有任务已经开始!", "提示", MessageBoxButtons.OK, MessageBoxIcon.information) s=true End If 以下这部分(红色代码)还是要继续往下执行的: If dr1 IsNot Nothing Then Tables("注意事项").filter = "提示 = 2 And 完成 = False" if s = false MessageBox.Show("有任务即将到期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information) s=true end if End If [此贴子已经被作者于2022/10/26 15:05:04编辑过]
|
-- 作者:njzwm -- 发布时间:2022/10/26 15:12:00 -- 谢谢 |