隐藏datagridview中的所有行 [英] Hiding all rows in datagridview

查看:104
本文介绍了隐藏datagridview中的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我想知道当用户单击添加新记录"按钮时,如何隐藏datagridview中所有显示的行,并仅显示空白的新行供用户输入数据.有什么帮助吗?谢谢.

Hi guys! I''m wondering how can I hide all the displayed rows in the datagridview when the user clicks the Add New Record button, and display only the blank new row for the user to input data. Any help please? Thanks.

推荐答案

最简单的方法是使用绑定源.

如果您将绑定源的条件设置为该行没有匹配的条件,那么我想它会起作用.

其他三个想法:

首先,如果您真的想让用户专注于输入新记录,我可能会考虑使用专门为数据输入而设计的新表格.

其次,您可以在新行上设置某种类型的验证检查.这样,用户只有在通过验证检查释放后才能切换到旧行.

第三,您可以尝试覆盖其他行的绘画.并不会阻止用户修改行,但是如果操作正确,则会使焦点移开.
Off the top of my head, the easiest way would be to use a binding source.

If you set the binding source''s criteria to something none of the row''s match, then I suppose it would work.

Three other ideas:

First, if you really want to keep a user focused on entering a new record, I would probably consider using a new form specifically designed for data entry.

Second, you could set up some type of validation check on the new row. That way, a user can''t switch to an old row until released by the validation check.

Third, you could try overriding the painting of the other rows. It''s not going to stop the user from modifying the rows, but if done right will take the focus off.


这篇关于隐藏datagridview中的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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