DataGridViewButtonColumn Text

Hi,

I'm a bit puzzled as my datagridview isn't following documentation.

privatevoid AddButtonColumn()
{
DataGridViewButtonColumn buttons =new DataGridViewButtonColumn();
{
buttons.HeaderText = "Sales";
buttons.Text = "Sales";
buttons.UseColumnTextForButtonValue =true;
buttons.AutoSizeMode =
DataGridViewAutoSizeColumnMode.AllCells;
buttons.FlatStyle = FlatStyle.Standard;
buttons.CellTemplate.Style.BackColor = Color.Honeydew;
buttons.DisplayIndex = 0;
}

DataGridView1.Columns.Add(buttons);

}

I want all DataGridViewButtonColumn's button text to read the same thing. However, I have tried this example and cannot get the DataGridViewButtonColumn to display any text at all. Any suggestions?

[939 byte] By [Blast] at [2007-12-22]
# 1

its working fine.

smilesai at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 2

The code is not working for me also.

Prathmesh

Prathmesh at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 3

For me, its working intermittently!

DanHadfield at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 4

Ok, I'm re-reading the thread. You have to have buttons.UseColumnTextForButtonValue set to false before you can change the text of the button. This said, it works intermittently for me. I'd like to know if this is a Microsoft bug or if I'm doing something wrong in my code.

DanHadfield at 2007-8-30 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...