I have a windows form application(done on VISUAL STUDIO 2008 ). I make use of a flow layout 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);
if (e.Button == MouseButtons.Left && e.Clicks == 2)
editToolStripMenuItem_Click(sender,e);
}
public void editToolStripMenuItem_Click(object sender, EventArgs e)
{
bool bFound = false;
moveCatergory frm = new moveCatergory();
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;
}
int k = 0;
if (k < allMovements.Count)
{
allMovements.Remove(allMovements[k]);
frm.sm.button_action.Text = frm.sm.dance_action.nametxt;
allMovements.Insert(k, frm.sm);
}
}
anyone knows what's the problem here?