Home > DeveloperSection > Articles > How to add button in DataGridView in CSharp .NET

How to add button in DataGridView in CSharp .NET


C# C# 
Ratings:
0 Comment(s)
 7516  View(s)
Rate this:

How to add button in DataGridView

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);

 


Don't want to miss updates? Please click the below button!

Follow MindStick