PDA windows Form

I need to develop a project which allow to control all the form flowing.

Which mean my PDA can handle 2 or more same form at the same time, in my menu bar i can choose to activated the form.

My problem is i do not know how to control the form while 2 or more SAME form open and store it into the menu bar.

For example

Dim NewFrm as frmOrder

NewFrm = New frmOrder ' First Form

'Then open the second Form

NewFrm = New frmOrder ' Second Form

In what method i can create a form in a child so that i can call Either FirstForm or Secod form



Answer this question

PDA windows Form

  • Mitch Wardrop

    Dear BrightAngel,

    If using one reference variable "NewFrm" here, the first Form will lose.

    I think you can use a list/array to maintain all these forms.

    Regards,

    Zero Dai - MSFT



  • EvilOneSD

    Dear BrightAngel,

    When we new a Form instance, we add it into the array. After then, if we want to get it back, we can just use index two fetch its reference back.

    Is this what you want

    If not, let's go on further discussion. Thanks.

    Regards,

    Zero Dai - MSFT



  • bfarr23

    How to create a form using array

    How can i maintain it


  • Adhvika

    Ya....I have store it using an array. then i wanna add into the menuitem, when user click on the menuitem the form will show up.

    Now my problem is,i loop the arraylist and add into the menuitem then how can i write the code for reactivated the form when user click on the menuitem i added in


  • ZZia

    Dear BrightAngel,

    We can compare the Form.Text and MenuItem.Text in MenuItem Click event handler.

    1. We can add new Form instance as following:

    Form newForm = new Form();

    newForm.Text = textBox1.Text;

    formList.Add(newForm);

    MenuItem newMenuItem = new MenuItem();

    newMenuItem.Text = textBox1.Text;

    newMenuItem.Click += new System.EventHandler(MyMenuItem_Click);

    mainMenu1.MenuItems.Add(newMenuItem);

    textBox1.Text = string.Empty;

    2. We can active the Form specified as following (Add in MyMenuItem_Click event handler):

    MenuItem item = (MenuItem)sender;

    Form activeForm = null;

    foreach (Form form in formList)

    {

    if (0 == string.Compare(item.Text, form.Text))

    {

    activeForm = form;

    break;

    }

    }

    if (activeForm != null)

    {

    activeForm.ShowDialog();

    }

    3. Use two member field to maintain the Form instance.

    List<Form> formList = new List<Form>();

    Regards,

    Zero Dai - MSFT



  • PDA windows Form