以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于生日提醒如何输出到消息提示框 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=153547) |
-- 作者:wh420 -- 发布时间:2020/8/14 14:20:00 -- 关于生日提醒如何输出到消息提示框 如何将满足未来几天过生日的多个人名输出到messagebox.show中? Dim ids As String Dim n As Integer = 9 \'未来天数,含今天,所以实际是未来7天 Dim eDate As Date = Date.Today.AddDays(n) For Each dr As DataRow In DataTables("员工").Select("姓名 is not null") Dim month As Integer = dr("生日").Month Dim day As Integer = dr("生日").Day Dim sDate As Date = new Date(Date.Today.Year, month, day) Dim days As TimeSpan = eDate - sDate If days.TotalDays <= 9 OrElse days.TotalDays > 365 Then ids = ids & "," & dr("_Identify") End If Next If ids > "" Then ids = ids.Trim(",") messagebox.show("未来"& n &"天内是" & “姓名” & "的生日,给他们送去祝福吧.","生日提醒") End If |
-- 作者:有点蓝 -- 发布时间:2020/8/14 14:36:00 -- Dim nms As String Dim n As Integer = 6 \'未来天数,含今天,所以实际是未来7天 For Each dr As DataRow In DataTables("员工").DataRows Dim dt As Date = dr("出生日期") Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day) Dim dt2 As New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day) If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then nms = nms & ",\'" & dr("姓名") & "\'" End If Next If nms > "" Then nms = nms.Trim(",") messagebox.show("未来"& n &"天内是" & nms & "的生日,给他们送去祝福吧.","生日提醒") End If |
-- 作者:wh420 -- 发布时间:2020/8/14 15:01:00 -- 收到,那如何对过生日的记录所在的行做颜色标记呢? |
-- 作者:wh420 -- 发布时间:2020/8/14 15:08:00 -- 只做颜色或样式标记,不做筛选。 |
-- 作者:有点蓝 -- 发布时间:2020/8/14 15:12:00 -- DrawCell事件代码: dim n as integer = 7 Dim dt As Date = e.row("出生日期") [此贴子已经被作者于2020/8/14 15:12:15编辑过]
|
-- 作者:wh420 -- 发布时间:2020/8/14 15:39:00 -- 问题解决,多谢老师。 |