DataGridView(同时可编辑和不可编辑列) [英] DataGridView(Editables and not editables columns at the same time)

查看:101
本文介绍了DataGridView(同时可编辑和不可编辑列)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Winform应用程序(用C#4.0编写)中可能有一个DataGridView控件,其中某些列是可编辑的,而另一些则不是?如何?还有另一种解决问题的方法吗?

假设我想在DataGridView控件中显示两列:"Number"和"IsPrime","Number"列将不可触摸,而"IsPrime"是一个bool列,您可以在其中设置是否为质数. ="h2_lin">解决方案

是的,当然!将列的ReadOnly属性设置为true,它将无法编辑.


是的,您可以执行此操作. Walt在该列中将您不希望编辑的列的ReadOnly属性设置为true,而您想对其进行编辑的那一个列,则将ReadOnly属性设置为False简单...


是的,只读属性for专栏将帮助您实现这一目标


It is possible to have a DataGridView control in a winform app(written in C# 4.0) where some columns will be editables and others do not? How? There is another way to solve the problem?

Suppose I wanna show two columns in my DataGridView control: "Number" and "IsPrime", the "Number" column will be untouchable while "IsPrime" is a bool column where you can set if the number is prime or not.

解决方案

Yes, of course! Set the ReadOnly property for the column to true and it won''t be editable.


yes u can do this. Walt is right set ReadOnly property to true of that column which u dont want to edit and whichone u want to be editable set ReadOnly property to False simple...


Yes, The Read Only property for column will help you to achieve this


这篇关于DataGridView(同时可编辑和不可编辑列)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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