如何在Windows应用程序中检查DataGridview控件中的现有项目 [英] How to check existing item in DataGridview control in windows Application

查看:58
本文介绍了如何在Windows应用程序中检查DataGridview控件中的现有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在项目中使用Data Gridview控件.在Data gridview控件中添加一些项目,然后如何检查gridview中的现有项目

解决方案

您要从中检索项目数据网格视图?如果是,



MyGridView.Rows [index]-将为您提供特定的数据行



MyGridView.Rows [index] .Cells [cellindex] .value-将为您提供每个字段值

DataGrid绑定到数据源.您检查数据源中是否有重复项,而不是数据网格.具体操作取决于所使用的数据源.


尝试此方法
BindingSource.Find方法


Hi,


I am using Data Gridview control in my project.Add some items in Data gridview control,then how to check existing item in gridview

解决方案

You wanted to retrieve the items from data grid view? If yes,



MyGridView.Rows[index] - will give you specific data row



MyGridView.Rows[index].Cells[cellindex].value - will give you each field value


The DataGrid is bound to a DataSource. You check the DataSource for duplicates not the DataGrid. How you do that is dependent on the DataSource being used.


try this method
BindingSource.Find Method


这篇关于如何在Windows应用程序中检查DataGridview控件中的现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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