Hi,
How can we add button to dataGridView control in windows form application?
Thanks.
How to add Button to dataGridView control
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Jan 18, 2012, 7:27 PM EST
Datta KharadRank #2,135 · 668 reputationPosted Jan 18, 2012, 7:43 PM EST
Add Button to datagridview Control:-
var buttonCol = new DataGridViewButtonColumn();
buttonCol.Name = "ButtonColumnName";
buttonCol.HeaderText = "Header";
buttonCol.Text = "Button Text";
dataGridView.Columns.Add(buttonCol);
foreach (DataGridViewRow row in dataGridView.Rows)
{
DataGridViewButtonCell button = (row.Cells["ButtonColumnName"] as DataGridViewButtonCell);
}