Closing a Dialogue Using a Tick Event
I am working on a football simulation. I'm writing the code when a quarter or half ends.
If any of you ever played Madden Football you know that when the time reaches zero the play calling screen disappears. This is exactly what I am trying to do. The play calling screen in my case is a dialog controlled by the main game screen (the main form controlling most of the game). I use the .ShowDialog event to display it.
What I want to do is close this dialog on a tick event. I'm not sure how to access this dialog if it was created as a local variable. I assume it's like finding any other control that was dynamically generated at run-time but I can't wrap my head around the proper syntax. Once I get the dialog in the tick event I want the dialog to close and return all control to the main game screen.
I've never tried to close a dialog without the user clicking a button on the dialog itself. This is different because the parent control is closing the dialog with its own event (Tick).
I hope I explained this well! :)
Thanks
Re: Closing a Dialogue Using a Tick Event
try setting the dialog's dialogresult property
Re: Closing a Dialogue Using a Tick Event
it'd be easier to keep track of if you'd declared it as a form level variable, but you can probably use:
vb Code:
my.application.openforms.oftype(of yourForm)
Re: Closing a Dialogue Using a Tick Event
Both of your methods worked. I went with making the dialog a private variable. It just seemed more secure in all circumstances. It was good to learn something new though. Thanks!