poorchap 0 Newbie Poster

I have a windows form application(done on VISUAL STUDIO 2008 ). It is about making a better GUI and i make use of a flowlayout panel and buttons. I have a problem on the buttons after copying and pasting it.
after double clicking the buttons , it'll lead to another form , but i got no idea how come after double-clicking to edit the original copy of the button it pops out the number of times(eg. frm.showdialog()) i pasted onto the panel. well i tried setting the copied button name to a new name after getting pasted but that problem still happens.However if i go through the context menu and select edit it'll work fine (form opens only once).

well i place the code from the edit toolstrip into the condition if(e.clicks==2)
which is wrong. (DURING RUN-TIME)

Is there something to do with parent and child relation?
anyone knows whats the problem here?

part of the code
pardon me if i didnt explain clearly

it goes something like this

 public void newbutton_MouseDown(object sender, MouseEventArgs e)


 { 

            prebutton = (Button)sender;

            Point p = new Point(e.X, e.Y);



                if (e.Button == MouseButtons.Right && count < 2)
                    cm_rightclick.Show(prebutton, p);//user supposedly right click ,then click onto edit to edit the moves on the button


             if (e.Button == MouseButtons.Left && e.Clicks == 2)
             editToolStripMenuItem_Click(sender,e);



 }

 public void editToolStripMenuItem_Click(object sender, EventArgs e)

  {

            bool bFound = false;


            //Initiating an instance of Move Category.cs form
            moveCatergory frm = new moveCatergory();

            //Using the FindSingleMovement FUNCTION
            SingleMovement sm = FindSingleMovement(ref  bFound);

            frm.sm =  sm;
           frm.ShowDialog();

            for (int i = 0; i < allMovements.Count; i++)
            {
                if (sm.button_action == allMovements[i].button_action)
                    break;


            }

            //FOR LOOP used for checking which dancestep is selected
            int k = 0;


            //After the checking is done, the selected dancestep list will be removed and the edited dancestep will be added
            if (k < allMovements.Count)
            {
                allMovements.Remove(allMovements[k]);
                frm.sm.button_action.Text = frm.sm.dance_action.nametxt;
                allMovements.Insert(k, frm.sm);

            }


        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.