Showing a Form that lies in bakground

Hi,

I have created a Shared Add-in, it contains a button, when you click on it, a System.Winidwos.Forms.Form shows up, now i have two problems that i can not solve them,

1. every time  you click on the button it shows a new form, I want that it shows just one form not more, even if you clicked on button many times. I mean I don't want to disable the button , the button must be enabled always, because of the following point:

2. when you work on the office document the form lies in bakground (not visible), when you clik on the button the form must shows up agin . how 

thanks you all


Answer this question

Showing a Form that lies in bakground

  • TcoUpLoad

    hi,

    This thread is a duplicate of another thread.so pointing to the recent thread.
    Link: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=395566&SiteID=1

    Thank you,
    Bhanu.



  • Vittorio Bertocci - MSFT

    For #1, keep track of the created form by having a reference to it. In other words the reference to the window will be null when the program first starts. When the user clicks the button, check the reference, if it is null, create the new window and assign the reference. When the user comes back on another click, check the reference, since it will not be null, do no create a new one.

    For #2, if you have the reference as mentioned above, you can have the form make itself visable...you will have to check the method call on the form class which will allow that to happen.


  • Showing a Form that lies in bakground