listbox.editCellAt not working after messageDialog

I have an editable listbox cell that triggers a messagedialog to allow the cell to be re-edited on loss of focus - see below. But the EditCellAt function doesn’t open the text for editing. If I call editCellAt from a button, it works fine. Any ideas?

Sub CellLostFocus(row as Integer, column as Integer) Handles CellLostFocus

Dim dlg As New MessageDialog
dlg.message = “edit or delete?”

dlg.ActionButton.Caption = “Edit”
dlg.AlternateActionButton.Caption = “Delete”
dlg.AlternateActionButton.Visible = True
dlg.CancelButton.Visible = False

Dim btn As MessageDialogButton = dlg.ShowModal

Select Case btn
Case dlg.ActionButton

Me.EditCellAt(row, column)

Case dlg.AlternateActionButton

Me.CellValueAt(row, column) = ""


End Select
End Sub

Have you tried setting focus to the ListBox first?


Yes, I tried that. I also tried putting in a short delay after the showModal to see if it was a timing issue, but neither of those worked.

I don’t have time to investigate right now, but I’m curious about that and will later.
For now, I imagine you can put a timer on your window, store the row and column in a property (a Pair is a good type for that), activate the timer (once) and the timer edits the cell.

Thanks Arnaud - yes a timer.calllater fixes the problem.

1 Like