Results 1 to 4 of 4

Thread: Closing a Dialogue Using a Tick Event

  1. #1

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    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
    Intermediate Level Programmer Extraordinaire

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Closing a Dialogue Using a Tick Event

    try setting the dialog's dialogresult property

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    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:
    1. my.application.openforms.oftype(of yourForm)

  4. #4

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    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!
    Intermediate Level Programmer Extraordinaire

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width