C#中的DataGridView [英] c# DataGridView
本文介绍了C#中的DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我需要捕获选定的索引更改事件和
如果某些条件不合适,请防止更改选定的索引.
当我在SelectionChanged上执行此操作时,可以检查并引发异常
但是尽管有异常但索引已更改
我想阻止我,我需要一个类似SelectionChanging
的事件
而不是SelectionChanged.
谢谢
Hello,
I need to catch selected index change event and
if some condtion is not suitable , prevent changing selected index.
when I do it on SelectionChanged , I can check and throw exception
but index is changed despite of exception
I want to prevent i , I need an event like SelectionChanging
instead of SelectionChanged.
Thanks
推荐答案
当更改选择索引再次订阅此事件并引发异常时,您可以取消订阅SelectionChanged.
You can unsubscribe from SelectionChanged when change selection index subscribe on this event again and throw exception.
这篇关于C#中的DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文