本文介绍了在datagridview中编辑单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序中有四个列的datagridview,我已将col 1和col 4设为只读,但是col 2的类型为string,而col 3的类型为date time,我该如何编辑这些列并替换新值.(这只是一个简单的应用,不涉及数据绑定)
在此先感谢,
I have datagridview in my application with four columns, I have made col 1 and col 4 as read only,but col 2 is of type string and col 3 is of type date time,how do i edit these columns and replace the new value.(this is just a simple appln no databinding involved)
thanks in advance,
推荐答案
dataGridView1.Rows.Add(new object[]{11, "Some text", DateTime.Now, 33});
dataGridView1.Rows[0].Cells[1].Value = "Some other text";
dataGridView1.Rows[0].Cells["Column3"].Value = DateTime.UtcNow;
顺便提一句.由于WPF中没有datagridveiw,因此我不明白为什么要使用WPF对其进行标记.
BTW. As datagridveiw is not available in WPF, I don''t understand why you have tagged this with WPF.
这篇关于在datagridview中编辑单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!