Dim chk as winform.CheckBox = e.form.controls("CheckBox3") dim d as date =format(date.now,"hh:mm:ss") If chk.checked = true then e.Sender.ReadOnly =BooleanEnum.True MessageBox.Show("已签过到了!!", "提示") Else if d>#16:00:00# then e.Sender.ReadOnly =BooleanEnum.True MessageBox.Show("太迟了,不能签到!!", "提示") elseif d<#14:00:00# then e.Sender.ReadOnly =BooleanEnum.True MessageBox.Show("太早了,到两点后再签到吧!!", "提示") End if End if
以上是我在“考勤表”窗口中对下午上班签到的筛选框的MouseDown事件中写的代码,但是每到下午两点以后(包括3、4点)去签到,即勾选对应的复选框时,还是提示:太早了,到两点后再签到吧,而不能签到,我估计是时间问题,不知我对时间的处理是否有问题?
|