To add button in DataGridView we have write the following code.

DataGridViewButtonColumn btnDGV= new DataGridViewButtonColumn();
//creating object of datagridview button.           
      btnDGV.Name = "Click";
//setting name of button to click
btnDGV.HeaderText = "Click";
//setting column title to click
      btnDGV.Text = "Click";
//setting button text to click
      btnDGV.UseColumnTextForButtonValue = true;
//this will enable button to show text

 

Now adding button to DataGridView

dgRecord.Columns.Add(btnDGV);

 


  1. I am really grateful to you for sharing such valuable post.

Leave Comment