如何在windows窗体中使特定的datagrid列可编辑 [英] how to make perticular datagrid column editable in windows form

查看:66
本文介绍了如何在windows窗体中使特定的datagrid列可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在开发visual studio 2008中的应用程序,

在我的应用程序中我动态创建这样的数据网格

hello,

I am developing my application in visual studio 2008,
in my application i am dynamically creating a datagrid like this

DataGridTableStyle gridstyle1 = new DataGridTableStyle();
gridstyle1.MappingName = dt1.TableName;
                    
DataGridColumnStyle columnStyle = new DataGridTextBoxColumn();
columnStyle.MappingName = dt1.Columns[0].ColumnName;
columnStyle.Width = 70;
columnStyle.HeaderText = dt1.Columns[0].ColumnName;
gridstyle1.GridColumnStyles.Add(columnStyle);

DataGrid dgDisplay = new DataGrid();
                   
dgDisplay.TableStyles.Add(gridstyle1);
dgDisplay.Location = new Point(4, 100);
dgDisplay.DataSource = dt1;

dgDisplay.Width = 220;

this.Controls.Add(dgDisplay);







因此问题是如何使特定列可编辑,我试图改变IsReadOnly属性,但它只是给出了错误。



以及如何将复选框放在datagrid的列中?

可能是什么原因?我无法在这里使用datagridview







事情是我只使用vs 2008 datagrid旧版本,并且在更改列的只读属性时,它给出的错误如属性或索引器无法分配给它只读

数据网格是否不支持这个?







提前致谢



Ginnas




so the problem is how to make the particular column editable, i tried to change the IsReadOnly properties and all but it is giving error .

and also how to put checkboxes in columns of datagrid?
what could be the reason? i am not able to use datagridview here



the thing is i am using vs 2008 datagrid only older version and while changing the readonly properties of column it is giving error like "property or indexer cannot be assigned to it is read only"
whether datagrid will not support this?



Thanks in advance

Ginnas

推荐答案

给出了什么错误?



DataTable中的列是你的绑定到ReadOnly?
What is the error being given?

Is the column within the DataTable you are binding to ReadOnly?


这篇关于如何在windows窗体中使特定的datagrid列可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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