C# DataGridViewButtonCell set buttons text

animekun picture animekun · Oct 3, 2013 · Viewed 56.9k times · Source

I need to add my DataGridViewButtonCell to Column, and I need to name each other with different names.

But I didn't find any text properties.

Can anyone help me, please?

i do that stuff

DataGridViewButtonCell b = new DataGridViewButtonCell(); 
b.Value = "name"; 
MainTable.Rows.Add(b);

and it doesn't work

Answer

Sriram Sakthivel picture Sriram Sakthivel · Oct 3, 2013

If you want all the buttons to have same text use UseColumnTextForButtonValue property.

If you want different text for each button then use DataGridViewCell.Value property