locked
How do you ensure a dialog is centered if you use a BACk button and then a forward button to reach it? RRS feed

  • Question

  • I go from form to form in my program by putting  the following in the NEXT button code:

    me.hide
    formWhatever.showdialog

    But suppose "formWhatever" has  a BACK button, that  also works by first hiding it, and then showing a form (the prior form, in the case of BACK buttons).  So if the user clicks BACK,he  comes back to the original (previous) form. 

    A user might change  one  or more settings on this original form, and click NEXT to get back to formWhatever.  

    But this  is what happens:

    formWhatever does appear, but it appears minimized - down by the taskbar

    I can solve this  - instead of using showdialog above, I could just use show().

    But I then find that going BACK produces  a prior form that is no longer centered (I generally center forms with 'me.centertoscreen' in their form_load event.)

    So to sum up, how do I go forward and backward in a series of forums such that they are not minimized when I reach them, and they are still centered?

    Thanks


    • Edited by Gidmaestro Wednesday, December 6, 2017 12:27 PM
    Wednesday, December 6, 2017 12:26 PM

Answers

  • Have you tried BringToFront method of the form ? You might need to use Active method first on the desired form.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Gidmaestro Wednesday, December 6, 2017 2:57 PM
    Wednesday, December 6, 2017 1:30 PM

All replies

  • Have you tried BringToFront method of the form ? You might need to use Active method first on the desired form.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by Gidmaestro Wednesday, December 6, 2017 2:57 PM
    Wednesday, December 6, 2017 1:30 PM
  • You should not do that a kind of unknown sequence of modal and non modal forms. There is not any end user which understand this and therefore it is lost of time to intvestigate how to improve the way it presents itself. 

    It is like throwing a coin in the air and try to improve how it falls on its third side and stays there


    Success
    Cor




    • Edited by Cor Ligthert Wednesday, December 6, 2017 2:59 PM
    Wednesday, December 6, 2017 2:55 PM