J
Joshua Frank
Hi All,
Is there any way to tell when the method you're in has exited? This
would be handy for things like:
Sub LongProcess()
'code
'code
ShowHourglass()
'long job...
'...
If IntermediateResultFails
'clean up
HideHourglass
Exit Sub
End If
'long job...
If IntermediateResultFails
'clean up
HideHourglass
Exit Sub
End If
HideHourglass
Exit Sub
In other words, you have to remember to HideHourglass before leaving the
method, but there are many ways, plus any exceptions, that you might
leave, and it's a pain to remember them all. In VB6 I used
deterministic finalization on an hourglass object:
Sub LongProcess
...
Hourglass.Show
...
End Sub
When the method ended, the object would go out of scope and hide the
hourglass, so there was no need to add this code, and no way to forget
to add it at every exit point.
So I'm looking for a way to accomplish this in .NET. I was thinking
there might be some way to do this:
Sub LongProcess
...
Hourglass.Show()
...
End Sub
and in the Show function, do some magic to figure out what the calling
method is and figure out when it has completed. .NET obviously knows
this, but how can we access it programmatically? Any help much
appreciated. Thanks.
Cheers,
Joshua Frank
Is there any way to tell when the method you're in has exited? This
would be handy for things like:
Sub LongProcess()
'code
'code
ShowHourglass()
'long job...
'...
If IntermediateResultFails
'clean up
HideHourglass
Exit Sub
End If
'long job...
If IntermediateResultFails
'clean up
HideHourglass
Exit Sub
End If
HideHourglass
Exit Sub
In other words, you have to remember to HideHourglass before leaving the
method, but there are many ways, plus any exceptions, that you might
leave, and it's a pain to remember them all. In VB6 I used
deterministic finalization on an hourglass object:
Sub LongProcess
...
Hourglass.Show
...
End Sub
When the method ended, the object would go out of scope and hide the
hourglass, so there was no need to add this code, and no way to forget
to add it at every exit point.
So I'm looking for a way to accomplish this in .NET. I was thinking
there might be some way to do this:
Sub LongProcess
...
Hourglass.Show()
...
End Sub
and in the Show function, do some magic to figure out what the calling
method is and figure out when it has completed. .NET obviously knows
this, but how can we access it programmatically? Any help much
appreciated. Thanks.
Cheers,
Joshua Frank