DataGridView Index -1 does not have a value 错误
遇到一个非常奇怪的问题,
一个DataGridView在装载数据后, 无论点击Column还是Cell都会报如下错误:
查bing之后发现StackOverFlow都指向DataSource的问题。
于是查看自己的写法:
var vt = dgvSummary.DataSource as List<MyTradeSummaryAtom>;
{
var atom = arg_atom;
if (null == atom.Strategy)
return ErrorObject.ReturnFalse("arg_atom的Strategy为Null");
var a = (atom.Strategy as Strategy_V1A1).Account;
var eo = ErrorObject.True;
var tsi = a.GetTradeSummaryInfo(_dtimeStart, _dtimeNext, out eo, 20000);
if (eo.IsFalse)
return eo;
vt.Add(tsi.全部交易概要.ToMyTradeSummaryAtom(atom));
}
this.InvokeEx(() =>
{
dgvSummary.DataSource = null;
dgvSummary.DataSource = vt;
}
);
可以看到dgvSummary的DataSource在更新数据前后的对象其实是同一个List
改为:
this.InvokeEx(() =>
{
dgvSummary.DataSource = vt.ToArray();
}
问题解决
DataGridView Index -1 does not have a value 错误的更多相关文章
- VS2015中DataGridView的DataGridViewComBoboxCell列值无效及数据绑定错误的解决方法
在VS2015中练习DataGridView的使用, 发现其中的DataGridViewComBoboxCell列存在着绑定数据库列后出现值无效的提示 根据网上的解决办法,添加了DataError后可 ...
- pandas里面过滤列出现ValueError: cannot index with vector containing NA / NaN values错误的解决方法(转)
###df_18的字段fuek是否包含 / df_18[df_18['fuel'].str.contains('/')] 报错: ValueError Traceback (most recent c ...
- C# winform DataGridView操作 (转)
C# DataGridView控件动态添加新行 DataGridView控件在实际应用中非常实用,特别需要表格显示数据时.可以静态绑定数据源,这样就自动为DataGridView控件添加相应的行.假如 ...
- ALTER TABLE SWITCH' statement failed. The table x' is partitioned while index 'x' is not partitioned.
1.L_Monitoring有这么些字段,ID,Collecttime,PlateType,PlateNO以及其他一些这段.建立这个表的时候是个非分区表,其中ID是主键,并在Collecttime,P ...
- [20180317]12c TABLE ACCESS BY INDEX ROWID BATCHED2.txt
[20180317]12c TABLE ACCESS BY INDEX ROWID BATCHED2.txt --//简单探究12c TABLE ACCESS BY INDEX ROWID BATCH ...
- winform datagridview控件使用
最近做项目时,显示查询结果总需要绑定到datagridview控件上显示,总结了给datagridview绑定数据的方式,以及导出datagridview数据到excel表格,如有错误请多指教 1.直 ...
- werkzeug.routing.BuildError: Could not build url for endpoint 'index'. Did you mean 'user.index' instead?
werkzeug.routing.BuildError: Could not build url for endpoint 'index'. Did you mean 'user.index' ins ...
- Ubuntu搭建lnmp环境
1.安装nginx 安装 sudo apt-get install nginx 服务启动.停止.重启 /etc/init.d/nginx start /usr/sbin/nginx -c /etc/n ...
- Struts2日期类型转换
针对日期类java.util.Date进行类型转换,要求客户端使用"yyyy-MM-dd","yyyy/MM/dd"中的任意一种输入,并以"yyyy- ...
随机推荐
- SegmentFault 巨献 1024 程序猿游戏「红岸的呼唤」第二天任务攻略
眼看实验室就要关门了.走之前写一下解题过程(事实上大家都等着第三题出来吧大概-=). 高速传送门:http://segmentfault.com/game/2 那么接昨天的博客,今天的题目是这种: 完 ...
- OBS桌面视频直播软件/推流工具使用指南
OBS 操作指南 什么是OBS? Open Broadcaster Software 是一款好用的互联网流媒体直播内容输入作软件. OBS使用是否收费? 不收费,这个程序和它的源代码都是免费的. OB ...
- EasyDarwin开源摄像机访问EasyCamera中海康摄像头语音对讲和云台控制转发实现
转自:http://blog.csdn.net/yanzhuomin/article/details/52887311 EasyCamera中关于摄像头SDK的调用都集中在EasyCameraSour ...
- netty+Protobuf (整合一)
netty+Protobuf 整合实战 疯狂创客圈 死磕Netty 亿级流量架构系列之12 [博客园 总入口 ] 本文说明 本篇是 netty+Protobuf 整合实战的 第一篇,完成一个 基于Ne ...
- Boosting AdaBoosting Algorithm
http://math.mit.edu/~rothvoss/18.304.3PM/Presentations/1-Eric-Boosting304FinalRpdf.pdf Consider MIT ...
- 【R】R语言生成随机数
1.概述 作为一种语言进行统计分析,R有一个随机数生成各种统计分布功能的综合性图书馆.R语言可以针对不同的分布,生成该分布下的随机数.其中,有许多常用的个分布可以直接调用.本文简单介绍生成常用分布随机 ...
- holiday和vacation的区别
holiday:假日vacation:假期a.对于英国人或者澳大利亚人来说,“假日”的意思等同于“假期”(尽管他们很少用“假期”)b.如果你是美国人,“假日”是指一个特殊的日子,好像圣诞节,而“假期” ...
- ICE学习笔记 -- RFC 5245
RFC 5245 ICE 1, offer/answer model 2, ICE Step: 1) 产生候选地址(1.公网 2.NAT反射 3.Relay转发地址) Generate ca ...
- ImageIO 操作图片
/** * 读取本地图片到另一个本地文件夹 * @throws IOException */ public void copeImageToOtherFolder() throws IOExcepti ...
- U盘安装Ubuntu 14.04 LTS正式版 出现如下的提示,不能继续,如何操作?
I had a problem (minor annoyance) when booting up Arch linux with a USB drive connected. The problem ...