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

How to add button in DataGridView in CSharp .NET


C# C# 
Ratings:
1 Comment(s)
 8356  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);

 


Thanks

By Sushant Mishra on   one month ago

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


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

Follow MindStick