以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  从字符串“红冲”到类型“Boolean”的转换无效  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=139848)

--  作者:304376480
--  发布时间:2019/8/23 9:25:00
--  从字符串“红冲”到类型“Boolean”的转换无效
老师您好,

DrawCell事件里的代码是:(‘红冲’是逻辑列)

 If e.Row("红冲") = True Then

    e.Style = "红字"

 End If


执行一种操作时,程序经常不定时的弹出这样的错误:


.NET Framework 版本:4.0.30319.36543
Foxtable 版本:2019.8.19.1
错误所在事件:表,经营记录,DrawCell
详细错误信息:
调用的目标发生了异常。
从字符串“红冲”到类型“Boolean”的转换无效。
输入字符串的格式不正确。


图片点击可在新窗口打开查看此主题相关图片如下:错误.jpg
图片点击可在新窗口打开查看



--  作者:有点蓝
--  发布时间:2019/8/23 9:40:00
--  
‘红冲’肯定不是逻辑列
--  作者:304376480
--  发布时间:2019/8/24 12:11:00
--  
帮我找一下问题到底出在哪个部位,可能不是DrawCell 事件代码的问题

我把DrawCell 事件代码改为:
If e.Table.Cols("红冲").IsBoolean AndAlso e.Row("红冲") = True Then
    e.Style = "红字"
End If

但还是会出现错误,这个错误有时候有,有时候没有,不知道是哪个参数出了问题,帮我找一找图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:错误.jpg
图片点击可在新窗口打开查看

System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。
参数名: index
   在 System.Collections.ArrayList.get_Item(Int32 index)
   在 C1.Win.C1FlexGrid.RowCollection.get_Item(Int32 index)
   在 C1.Win.C1FlexGrid.C1FlexGrid.DrawRow(PaintEventArgs e, Int32 row)
   在 C1.Win.C1FlexGrid.C1FlexGridBase.#adb(PaintEventArgs #tQ)
   在 C1.Win.C1FlexGrid.C1FlexGridBase.OnPaint(PaintEventArgs e)
   在 System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
   在 System.Windows.Forms.Control.WmPaint(Message& m)
   在 System.Windows.Forms.Control.WndProc(Message& m)
   在 C1.Win.C1FlexGrid.Util.BaseControls.ScrollableControl.WndProc(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** 已加载的程序集 **************



--  作者:有点蓝
--  发布时间:2019/8/24 14:05:00
--  
窗口beforeclose和afterclose事件写了什么代码?