vb计时问题
来源:百度知道 编辑:UC知道 时间:2024/09/23 11:20:13
Dim a
a = Format(dt, "dddd")
Select Case LCase(a)
Case "saturday"
ifweekend = True
Case "sunday"
ifweekend = True
Case Else
ifweekend = False
End Select
End Function
Private Function getDiffWorkDay(ByVal minDate1 As Date) As Integer
Dim i As Integer
Dim iCount As Integer
Dim d As Date
For d = minDate1 To Now
If ifweekend(d) = False Then
iCount = iCount + 1
End If
Next d
getDiffWorkDay = iCount - 1
End Function
for ii = 1 To rs.RecordCount
If MSHFlexGrid1.TextMatrix(ii, 15) = "" And MSHFlexGrid1.TextMatrix(ii, 17) = "处理完成" And MSHFlexGrid1.TextMatrix(ii, 17) = "" Then
Else
If getDiffWorkDay > Left(MSHFlexGrid1.TextMatrix(ii, 17), 1) Then
MSHFlexGr
If MSHFlexGrid1.TextMatrix(ii, 15) = "" And MSHFlexGrid1.TextMatrix(ii, 17) = "处理完成" or MSHFlexGrid1.TextMatrix(ii, 17) = ""
逻辑不对
到底是前面与了和后面或,还是前面与和后面2个的或
加括弧
IF判断里多加两个括号吧,可以更清楚一些。
用括号把两个判断分开层次,如果不用括号,怎么让别人明白你的想法啊?难道真的按从左到右的逻辑优先级进行判断啊?
And 和 Or 有点乱。
Private Function ifweekend(ByVal dt As Date) As Boolean
Dim a
a = Format(dt, "dddd")
Select Case LCase(a)
Case "saturday"
ifweekend = True
Case "sunday"
ifweekend = True
Case Else
ifweekend = False
End Select
End Function
Private Function getDiffWorkDay(ByVal minDate1 As Date) As Integer
Dim i As Integer
Dim iCount As Integer
Dim d As Date
For d = minDate1 To Now
If ifweekend(d) = False Then
iCount = iCount + 1
End If
Next d
getDiffWorkDay = iCount - 1
End Functio