ListBox.EditCell help

ListBox.EditCell says “When the user presses tab or return or click, the cell loses focus and the contents are saved.” Where? Do I need to add code to change the recordset and reload and to save it to the database table? New here and need some guidance

The contents are saved back into the listbox. When you edit a cell, the contents are actually copied into a textfield positioned right over the cell, so it appears that you are editing the listbox directly, but you’re not.

So yes, you are responsible for saving the data to the database (or wherever else it might be stored).

Thanks. Now on to some new code.

How do I get to that value after changing…the one in the text field over the cell? Another unknown to me…after making a change, press return to save. If I press return again the app closes. What am I missing?

Jim, you’re overthinking it. When the cell loses focus after editing it contains the edited contents, regardless of how the underlying system does it. So, all you have to to is save that cell’s data to wherever you need to. In your save routine, simply refer to the cell by location (row and column) to get the value, assign it to a variable for saving into the database or wherever you need it to go. Your save action may be in the LostFocus event handler or somewhere you feel is better to have it.

// Note that this is not real code. Dim tempStr As String tempStr = Listbox1.Cell(<the Row>, <the Column>) ' supply the row and column numbers SaveSomewhere (tempString)

I have a ListBox with two events: DoubleClick and CellLostFocus. DoubleClick gets row/column and makes it editable. CellLostFocus processes the change and uses row/column values. How can I get the row/column values from DoubleClick into CellLostFocus? Do I use a dictionary? Thanks again for the help.

You do not need to do that. ListBox.Cell(row, column) will automatically contain the new value after the text field has lost focus.

I need the colum row values created in DoubleClick to use in CellLostFocus.

Those values are passed to you in CellLostFocus. You don’t need to remember them yourself.

You are right. Found it. Thanks.