ListBox.EditCell


Warning

This item was deprecated in version 2019r2. Please use DesktopListBox.EditCellAt as a replacement.

Description

Scrolls the row, column cell into view (if necessary) and temporarily makes the cell editable. row and column are zero-based. It sets the focus within the ListBox to the row, column cell and selects its contents, if any. The editable cell has a focus ring around it.

Notes

Use the CellTypeAt or ColumnTypeAt properties to change a cell or column to “inline editable” when you want the user to be able to edit the contents of the ListBox. Then call the EditCell method for each cell. This gives the editable cell the focus and selects the current text of the cell, if any. Typing replaces the cell's contents. When the user presses Tab or Return or clicks in another cell, the cell loses the focus and the contents of the cell are saved (this also calls the CellAction event handler).

When a cell is editable, the ActiveTextControl property is the TextEdit that contains the contents of that cell. This may be a TextField or a TextArea depending on the specified column type. You can use this property to set or get the text of the Listbox cell, set the selection, or change other properties of the ListBox's TextField or TextArea.

Sample code

The following code in the CellClick event makes the cell the user clicked on editable. The parameters row and column are passed to the function.

Me.CellTypeAt(row, column) = Listbox.TypeEditableTextField
Me.EditCell(row, column)

This code marks an entire column as editable:

ListBox1.ColumnType(3) = ListBox.TypeEditableTextArea

In the CellClick event handler, you can then check if the column was clicked and then enable editing:

If column = 3 Then
  Me.EditCell(row, column)
End If

Compatibility

All projects types on all supported operating systems.