)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use a PushButton in a cell of WinForms GridControl ?

Platform: WinForms |
Control: GridControl |
Published Date: April 30, 2011 |
Last Revised Date: December 17, 2019

Push button cell type

In GridControl, you can set the CellType property to PushButton and the button is handled by using the grid’s CellButtonClicked event.

C#

//set the celltype into pushbutton
this.gridControl1[3, 3].CellType = "PushButton";
this.gridControl1[3, 3].Description = "Push Me";
//the pushbutton is handled using the CellButtonClicked event.
void gridControl1_CellButtonClicked(object sender, Syncfusion.Windows.Forms.Grid.GridCellButtonClickedEventArgs e)
{
string s = string.Format("You Clicked ({0},{1})cell", e.RowIndex, e.ColIndex);
MessageBox.Show(s);
}

 

VB

'set the celltype into pushbutton
Me.gridControl1(3, 3).CellType = "PushButton"
Me.gridControl1(3, 3).Description = "Push Me"
'the pushbutton is handled using the CellButtonClicked event.
Private Sub gridControl1_CellButtonClicked(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCellButtonClickedEventArgs)
Dim s As String = String.Format("You Clicked ({0},{1})cell", e.RowIndex, e.ColIndex)
MessageBox.Show(s)
End Sub

 

The following screenshot displays the PushButton added into the cell.

Show the push button in a grid cell

Figure 1: The PushButton is added into the cell

Note:

The pushbutton is also handled by using PushButtonClicked Event.

 

Samples:

C#: PushButton_Cell

VB: PushButton_Cell

Reference link: https://help.syncfusion.com/windowsforms/grid-control/cell-types#pushbutton-cell-type

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon