本文介绍了如何更改DataGridViewButtonColumn文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道如何动态(运行时)设置dataGridViewButtonColumn吗?我创建了一个DataGridViewButtonColumn对象,并将其添加到我的dataGridView中.
Does anyone know how to set dataGridViewButtonColumn dynamically (run-time)? I''ve created a DataGridViewButtonColumn object and add it to my dataGridView.
DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
btn.UseColumnTextForButtonValue = true;
btn.Text = "Hello";
dataGridView1.Columns.Add(btn);
private void rndMethod(string newText)
{
btn.UseColumnTextForButtonValue = false;
btn.Text = newText;
btn.UseColumnTextForButtonValue = true;
}
这是行不通的.我没有看到我的按钮文本更改.我缺少什么和/或做错了什么?
预先感谢,
-DA
This is not working. I''m not seeing the my button''s text changed. What am I missing and/or doing wrong?
Thanks in advance,
-DA
推荐答案
这篇关于如何更改DataGridViewButtonColumn文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!