Hi Minton
A code example would be great.
Thanks
Regards
Ok, this is untested and pre-caffeine but should work just fine:
In the modal dialog, in the general declarations:
Event FetchedValue(lValue as long, bCanceled as boolean)
Private sub OK_Click()
Raiseevent FetchedValue(1,False)
End Sub
Private sub Cancel_Click()
Raiseevent FetchedValue(2,True)
End Sub
Then in the calling form:
(General decs)
Dim WithEvents fMyDialog as Form_frmModalDialog
Public Function fMyDialog_FetchedValue(lValue as long, bCanceled as
boolean) -- NOTE: this is found from the procedure dropdowns and
has to be selected this way
if not bcanceled then
msgbox "I just got " & lValue & " from the dialog."
end if
end function
The nice thing about this is that you don't need to halt code (useful
for when timers are running, for example) and if you pass the
fMyDialog reference around, other objects can subscribe to the events
too. That's obviously not so useful for an OK/cancel dialog, but works
great for forms such as keypad entry.
Essentially, this is more of a VB code construct but is extremely
robust. I use this in POS applications for publishing changes in the
order context across all open objects, without having to keep track of
the open objects. Let me know if this helps or if you need more info!
-- James