Category / Section
How to use a PushButton in a cell of WinForms GridControl?
2 mins read
Push button cell type
In WinForms GridControl,
you can set the CellType property to PushButton, and
the button is handled by using the grid’s CellButtonClicked event.
//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);
}'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
to the cell.

Figure 1: The PushButton is added into the cell
Note:
The pushbutton is also handled by using the PushButtonClicked Event.
Samples:
C#: PushButton_Cell
VB: PushButton_Cell
Reference Link: Cell Types