如何在Datagridview C#.net中禁用行选择 [英] How To Disable Row Selection in Datagridview C#.net

查看:183
本文介绍了如何在Datagridview C#.net中禁用行选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,用于将客户的洗衣详细信息从数据库填充到datagridview上.我想将这些行标记为已禁用(即变灰),以便用户无法选择这些行.

我尝试了一些操作,例如将这些行设置为只读,禁用datagridview.我只想禁用其余几行(从数据库中获取的行),其余应启用/选择用户输入新数据的行.

感谢任何帮助.
请提供代码/示例.

谢谢
干杯
:)

I have a form where I am populating laundry details for the customer from the database onto datagridview.I want to mark these rows as disabled i.e grayed out , so that the user is unable to select these rows.

I have tried a few things such as making these rows read-only,making datagridview disable.I want to make only a few rows disabled(those fetched from database) rest of the rows where user makes a new data entry should be enabled/selected.

Appreciate any Help.
Please provide the code/examples.

Thanks
Cheers
:)

推荐答案

project99写道:
project99 wrote:

请提供代码/示例.



因为如果我们告诉您该怎么做,您将不懂足够的C#来了解我们?

为什么将它们设置为只读不起作用?如果您以自己想要的方式呈现它们,并且作为单独的东西,捕捉与这些行相关的鼠标/kb动作并拒绝它们而不进行编辑,该怎么办?



Because if we tell you what to do, you won''t know enough C# to understand us ?

Why does making them read only not work ? What if you render them the way you want to, and as a seperate thing, catch the mouse/kb actions related to those rows and reject them without allowing an edit ?


Don''t发布虚假答案,编辑您的帖子.您显然需要按照我说的做,处理启动删除过程的事件,检查行是否为只读,如果是,则停止删除.没什么可做的.
Don''t post fake answers, edit your post. You obviously need to do what I said then, handle the events that start the delete process, check if the row is read only, and if so, stop the delete. Nothing else is going to work.


您误认为以上不是我的回答,而是对您的qs的答复,为什么不是只读的."

就像我说的那样,因为这不是答案,所以不要按写有ANSWER的按钮,而是编辑帖子以添加详细信息.
"You have mistaken the above was not my answer but a reply to your qs as why not read-only."

As I said, BECAUSE it''s not an answer, don''t push the button with ANSWER written on it, but instead, edit your post to add the detail.


这篇关于如何在Datagridview C#.net中禁用行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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