Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Singleton MDI Children?
posted

Say I have an UltraExplorarBar on the left in the MainForm. On the bar there's 3 items, customer A, B, and C, and the MainForm acts as MDI Parent. In the project I have a CustomerForm so that if you click on the item on the bar, a customer form pops up on the right in MainForm. The problem is, how can I ensure that there's only one CustomerForm pops up for customer A, if user clicks the customer A icon serveral times? It looks like that I can't use singleton pattern on the CustomerForm becuase serveral customers share the same form object.

What whould be the best way to implement the? Is there any build-in thing in Infragistics that can help with this?

Parents
No Data
Reply
  • 145
    posted

     Use this method ..may be usefull for u ...i created based on form text ...replace with form name (MdiChildren[i].name) ...like that..

    if (ActivateThisChild(formText) == false) then open form logic ...

     

    ---------------------------------------------------------------------------------

    private Boolean ActivateThisChild(String formText)

    {

    int i;

    Boolean formSetToMdi = false;

    for (i = 0; i < this.MdiChildren.Length; i++)

    // loop for all the mdi children

    {

    if (this.MdiChildren[i].Text == formText)

    // find the Mdi child with the same name as your form

    {

    // if found just activate it

    this.MdiChildren[i].Activate();formSetToMdi = true;

    }

    }

    if (i == 0 || formSetToMdi == false)

    // if the given form not found as mdi child return false.

    return false;

    else

    return true;

    }

     

Children
No Data