Hi, I'd appreciate someone taking a look at this as I can't see what's going on. I have a parent form populated with buttons, when a button is clicked a new form opens via ShowDialog. When I close the child form the parent form updates, and when I click a button the second time the child form spawns twice, but the second one is only opened when the first is closed. Every time the parent is refreshed a duplicate is "primed" to appear the next time the button is pressed. I only want the one child form to appear, yet after e.g. 10 parent refreshes 10 child forms will be called - consecutively, not concurrently, I should add; each child will appear when the previous one is closed.
Code below:
	So when LoadButtons() is called it appears to be asking for duplicate forms to be called next time a button is clicked. Is it something to do with the bttn.Click event handler?
I'm sure the solution is obvious, but I just can't see it. Hope you can help,
Many thanks
Howard Parker
					Code below:
Code:
	public void LoadButtons()
        {
            int ButtonCount = 0; // Counter for the database, but no checksum
            Routines.BuildCurrentDatabase(); // Calls a string array
            foreach (Control bttn in T7_Layout.Controls)             {
                if (bttn is Button)
                {
                    string textline = Routines.LinesOfText[ButtonCount]; //takes one line from string array
                    bttn.Text = textline;
                    ButtonCount ++;
                    bttn.Click += new EventHandler(CallButtonView);
                }
            }
public void CallButtonView(object sender, EventArgs e)
            Button btn = (Button)sender; // The sender must == col1 in the text files
            string out_text = btn.Name;
            string number_out = out_text.Remove(0, 6);
            int Button_Select = int.Parse(number_out);
            vars.ButtonSelector = Button_Select - 1; // storing the number in a public variable
            Button_View showbuton = new Button_View();
            showbutton.ShowDialog(); // Bring up child form
            LoadButtons(); // called when the child is closed.
            } // Abridged - the variables are reset to zero or ""
I'm sure the solution is obvious, but I just can't see it. Hope you can help,
Many thanks
Howard Parker
Comment