I recently ran across a situation where if the user is editing a cell in a listbox and clicks the app's close box, the app generates a runtime error. To get around the problem (in an admittedly ugly fashion), in the window's Close handler I force a different control to get the focus. By doing this, the edits in the cell are lost, as they should be, and the runtime error is circumvented.
My question is this: is this really the best way to handle it or is there a "proper" approach?
BTW, if it makes any difference, I'm running 2018r3 on a Windows 10 system.