惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
G
Google Developers Blog
P
Privacy & Cybersecurity Law Blog
SecWiki News
SecWiki News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News: Ask HN
Hacker News: Ask HN
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
The Exploit Database - CXSecurity.com
博客园_首页
Latest news
Latest news
T
Threat Research - Cisco Blogs
N
News and Events Feed by Topic
TaoSecurity Blog
TaoSecurity Blog
罗磊的独立博客
月光博客
月光博客
C
Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
MyScale Blog
MyScale Blog
Spread Privacy
Spread Privacy
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
G
GRAHAM CLULEY
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
人人都是产品经理
人人都是产品经理
K
Kaspersky official blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
量子位
I
Intezer
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
D
DataBreaches.Net
宝玉的分享
宝玉的分享
S
Security @ Cisco Blogs
Help Net Security
Help Net Security
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 周克

te 关于博客园是否可以开展培训业务的几点思考 - 周克 - 博客园 【收集】Web开发工具 感情 程序 祭 Linq本质论(1) WinForm自动菜单合并 .Net开源控件 Client Settings FAQ .Net学习课件 ClickOnce 部署多语言程序需要注意的地方 WinFX更名为 .NET Framework 3.0. BindingSource.AddingNew事件可以给新增数据设置需要的值 介绍一个可以读取保存在程序集里面的图片资源的小工具 vs2005强类型主从表加上级联约束后无法添加从表数据 MSDN中文资料库WWF链接(updating...) 在WinForm中使用Membership WWF动态加载xoml文件 固定Asp.net2.0 Web项目的动态端口号 深圳.Net俱乐部2.26活动资源下载之——从SmartClient到ClickOnce
可恶的AutoSizeColumnMode和DataError
周克 · 2006-05-29 · via 博客园 - 周克

项目中DataGridView中使用了DataGridViewComboBoxColumn,不记得在哪里看到AutoSizeColumnMode设置成allcells,AutoSizeRowsMode=None,觉得蛮好的,结果把所有表单的DGV都设置成这样,不幸的意外发生了:结果关闭表单的时候就会发生DataError错误,说什么DataGridViewComboBoxCell的值不合法。
这时候还不知道哪里出了问题,以为绑定的顺序有问题,结果无奈之中把所有DGV加了个空的DataError 处理。
后来不甘心,到MSDN论坛上一查,原来碰到这个问题的不止我一个:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=157106&SiteID=1&PageID=2
下面是DataGridView Program Manager的解答:
 The issue is that the Form's dispose method is first disposing the datasource that the combobox column is using before it is disposing the DataGridview. This is the same as not databinding the combobox column at all. This only causes a problem when autosizing the rows or autosizing the combobox column since removing the combobox column's datasource causes the row/column to perform autosize layout. As part of the layout, the combobo cell needs to retrieve the FormattedValue, which raises the DataError since the cell cannot find a match in the combobox (since the combobox column's datasource is now null).
和处理办法:
The easiest way to fix this is to change the autosize mode of the grid in the form's dispose method. Alternatively you can manually databind the combo box column, including manually creating the BindingSource. This will allow you to manually dispose the combobox column's binding source on your own -- after the grid has already disposed.

未来:
 Currently we do not have any way to specify any dependency for disposing, but in 2005 we did create better support for dependencies when initializing controls/components. Sounds like we need to create some new support to deal with this type of problem.
I've opened a bug to address this issue hoping that we can do something in the next version.
提示: 
以后遇到问题多泡泡MSDN的论坛,比国内的好上一百倍,因为有微软的测试或者设计人员及时解答您的提问。