CellButtonClick Event

Fired after the user clicks a cell button.

Syntax

Private Sub VSFlexGrid_CellButtonClick( ByVal Row As Long,  ByVal Col As Long)

Remarks

This event is fired when the user clicks an edit button on a cell. Typically, this event is used to open a custom editor for the cell (for example, dialog boxes for selecting colors, dates, files, pictures, and so on.).

By default, cell edit buttons are displayed on the right side of a cell, with an ellipsis caption ("..."). They are similar to the buttons displayed in the Visual Basic Property window next to picture properties. You may customize their appearance by assigning a picture to the CellButtonPicture property.

To create an edit button on a cell, you must set the Editable property to True and set the ComboList (or ColComboList) property to an ellipsis.

For example, the following code assigns edit buttons to the first column of a grid, then traps the CellButtonClick event to show a color-pick dialog box and assign the selected color to the cell background:

    Private Sub Form_Load()

        fg.Editable = flexEDKbdMouse

        fg.ColComboList(1) = "..."

    End Sub

    Private Sub fg_CellButtonClick(ByVal Row As Long, ByVal Col As Long)

        CommonDialog1.ShowColor

        fg.Cell(flexcpBackColor, Row, Col) = CommonDialog1.Color

    End Sub

See Also

VSFlexGrid Control