I have an application that I am working on that requires the user to indicate a reason why they are deleting an item. The problem is that when you select the reason code from reason table and close the reason code screen the selected code is not being captured.
I have tried the doevents and also timers events, to no avail. In debug the program complete the sub before it ever gets to the reason screen.
Could someone please take a look at the attached code and indicate what I am doing wrong. Please note: the get_reason is also used in another part of the full program.
I'm not sure if that is the case here, but you shouldn't close the form from inside the SelectionChanged event. A timer (set to 10ms) should solve it:
B4X:
Sub reasonlist_SelectionChanged (ColName, Row) ' reason code selection
reasonc = reasonlist.Cell ("R.Code", reasonlist.SelectedRow)
Msgbox (reasonc)
tmrCloseForm.Enabled = True
End Sub
Sub tmrCloseForm_Tick
tmrCloseForm = False
realist.Close
End Sub