老师,我的DrawCell事件代码如下:正常情况系统不会显示错误,执行查询代码后出现错误信息为:“从字符串“预计开工日期”到类型“Date”的转换无效”,您给看看是什么情况?
Dim r As Row = Tables("在制工单信息").Rows(e.Row.Index)
Dim dt1 As Date = r("预计开工日期")
Dim dt2 As Date = r("预计完工日期")
Dim dt As Date = e.Col.Name.Replace("甘特图","").Replace("年","-").Replace("月_","-")
Dim dt3 As Date = r("生产开工日期")
Dim dt4 As Date = r("结单日期")
Dim dt5 As Date = Date.Today
Dim dt6 As Date = r("期望完工日期")
'Dim dt6 As String = r("订单状态")
Dim dt0 As Date = e.Col.Name.Replace("甘特图","").Replace("年","-").Replace("月_","-")
If dt = Date.Today Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.Pink,e.x + 1 ,e.y + 1, e.Width - 2, e.Height - 2)
e.EndDraw()
End If
If r.IsNull("期望完工日期") Then
If dt>=dt1 AndAlso dt<=dt2 Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 3, e.Width, e.Height - 16)
e.EndDraw()
End If
If r.IsNull("结单日期") Then
If r.IsNull("生产开工日期") Then
Else
If dt0>dt2 Then
If dt0>=dt3 AndAlso dt0<=dt5 Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.Coral,e.x ,e.y + 13, e.Width, e.Height - 16)
e.EndDraw()
End If
Else If dt0<=dt2 Then
If dt0>=dt3 AndAlso dt0<=dt5 Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.SpringGreen,e.x ,e.y + 13, e.Width, e.Height - 16)
e.EndDraw()
End If
End If
End If
End If
Else
If dt>=dt1 AndAlso dt<=dt6 Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.Yellow,e.x ,e.y + 3, e.Width, e.Height - 16)
e.EndDraw()
End If
If dt0>dt6 Then
If dt0>=dt3 AndAlso dt0<=dt5 Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.Coral,e.x ,e.y + 13, e.Width, e.Height - 16)
e.EndDraw()
End If
Else If dt0<=dt6 Then
If dt0>=dt3 AndAlso dt0<=dt5 Then
e.StartDraw()
e.Graphics.FillRectangle(Brushes.SpringGreen,e.x ,e.y + 13, e.Width, e.Height - 16)
e.EndDraw()
End If
End If
End If