选择datagrid行时出错 [英] Error on selecting datagrid row

查看:85
本文介绍了选择datagrid行时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,



在我的Windows窗体应用程序中,我有一个数据网格和一个组合框。

表格加载我绑定了组合框和数据网格。

当我更改组合框的文本时,它会更改datagrid中的值。

此代码我用combobox的SelectedIndexChanged事件编写。

但是当我选择特定的网格行时它会触发组合框的SelectedIndexChanged事件并给我错误

操作无效,因为它导致对SetCurrentCellAddressCore的重入调用功能。

plz帮我解释为什么会出现这样的错误。提前谢谢。

Hello friends,

In my windows form application i have one datagrid and one combobox.
at form load i binded both the combobox and datagrid.
when i change the text of combobox it changes the value in datagrid.
this code i have written in combobox's SelectedIndexChanged event.
but when i select particular row of grid it fires the SelectedIndexChanged event of combobox and gives me error
"Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function."
plz help me why such error occurs. thanks in advance.

推荐答案

为ComboBox和GridView创建不同的数据集

并使用各自的数据集绑定控件
Create Different Dataset For Both ComboBox And GridView
And Bind The Controls With Their Respective Dataset


这篇关于选择datagrid行时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆