如何使用4 ComboBox过滤DataGridView中的数据

编程入门 行业动态 更新时间:2024-10-10 07:27:54
本文介绍了如何使用4 ComboBox过滤DataGridView中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有包含一些细节的DataGridView,我想使用4来过滤这些数据 ComboBoxes。 全心全意付款 我很抱歉因为我的英语不好 这是一个例子 www.gulfup/?kWMojY [ ^ ]

I have DataGridView that Contains Some Details , I want filter these Data using 4 ComboBoxes . Thanks For All I'M Sorry Because My Poor English This Is An Example www.gulfup/?kWMojY[^]

推荐答案

这成为一个设计问题。我发现最好有4个组合和一个应用过滤的按钮。在按钮的单击事件中,您根据组合框的选定项将过滤应用于基础数据集。 该按钮允许用户从中进行选择每个组合然后应用过滤器。如果您使用组合的更改事件,则仅基于当前组合过早地应用过滤! This becomes a design issue. I find that it is best to have the 4 combos and a button that applies the filtering. In the click event of the button you apply the filtering to the underlying data collection based on the selected items of the combo boxes. The button allows the user to select from each combo and then apply the filter. If you use the change event of the combo's the filtering is prematurely applied based on only the current combo!

如果您想在每次用户更改组合框选择时进行过滤,则需要: 为OnChangeEvent的每个组合框添加一个事件处理程序(在属性窗口中更改为事件视图,然后双击OnChange) 在每个事件处理程序中: 从组合框中获取所选值 过滤填充datagridview的集合 注意您可能需要更新DGV的绑定。 您真的需要尝试自己帮助! If you want to do the filtering every time a user changes a combobox selection you need to: Add an event handler to each combobox for the OnChangeEvent (change to the event view in the properties window and double click on the OnChange) In each event handler: Get the selected value from the combobox Filter the collection populating the datagridview Note you may need to update the binding of the DGV. You really need to try and help yourself!

没有人可以帮助我, 有人帮助我 No one can help me , Some one help me

更多推荐

如何使用4 ComboBox过滤DataGridView中的数据

本文发布于:2023-11-13 04:33:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583440.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   数据   ComboBox   DataGridView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!