如何限制用户编辑datagridview单元格中的数据 [英] how to restrict the user from editing the data in a datagridview cell

查看:104
本文介绍了如何限制用户编辑datagridview单元格中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< pre lang ="text"></pre>您好我正在处理一种基于C#.net窗口的应用程序表单,在该表单中,我放置了一个无界的datagridview控件.在运行时,它将填充datagridview,但是问题是,当用户用来编辑数据时,会对其进行编辑.而且我需要限制该版本/或在运行时由用户在datagridview中键入数据.

<pre lang="text"></pre>hello I m working on one C#.net window based application form in which, I had put one datagridview control which is unbounded. On run time it will fill the datagridview but the problem is that when the user used to edit the data, it is edited. And I need to restrict that edition/or type the data in datagridview by the user at runtime.

推荐答案

您可以将列或行的readonly标志设置为true级别.
You can set the readonly flag to true at the column or row level.
dataGridView1.Rows[0].ReadOnly = true;<br />
dataGridView1.Rows[0].Cells[1].ReadOnly = true;


你好abhinav,

我几乎在我的代码中尝试过这些,但是没有用.仍然允许我在datagridview单元格中输入..请帮助我.

预先感谢
hello abhinav,

I had almost try these in my code, but it doesnt work. Still it allow me to type in the cell of datagridview.. Please help me.

Thanks in advance


这篇关于如何限制用户编辑datagridview单元格中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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