Send back "OK" need some help...

Need some help to SEND back OK to the lable, With contextMenuStrip1... Plz help me i have upload som kod to do it easy^^ for me and you... I hopp you help me. THX
http://www.sendmefile.com/00457366


Answer this question

Send back "OK" need some help...

  • Corres

    This cod is at events MouseDown in panel1, after you pres Mouse down ju send back OK to the lable1...

    private void testDOWN(object sender,MouseEventArgs e)
    {
    label2.Text = sender.ToString();
    Panel ActivePanel = (Panel)sender;
    foreach (Control ctrl in ActivePanel.Controls)
    {
    if (ctrl is Label)
    {
    ctrl.Text = "OK";
    }
    }
    }



    This cod is oKToolStripMenuItem_MouseDown in panel1, when he send back is stop work... Help me to send back OK to the Lable1...

    private void oKToolStripMenuItem_MouseDown(object sender, MouseEventArgs e)
    {
    label2.Text = sender.ToString();
    Panel ActivePanel = (Panel)sender;
    foreach (Control ctrl in ActivePanel.Controls)
    {
    if (ctrl is Label)
    {
    ctrl.Text = "WTF FFS _ ";
    }
    }
    }

  • fddsfsdf

    sorry, i dont quite understand the question - what do you want to send back to the label when do you want this to happen please post the code here where you are having a problem, rather than attaching the solution link to the file

  • bslim

    Opss.. First time I test sendmefile.com

    http://www.sendmefile.com/00457366

    I hopp it work now..
    Need help to send back

        private void testDOWN(object sender,MouseEventArgs e)
            {
                label2.Text = sender.ToString();
                Panel ActivePanel = (Panel)sender;
                foreach (Control ctrl in ActivePanel.Controls)
                {
                    if (ctrl is Label)
                    {
                        ctrl.Text = "OK";
                    }
                }
            }

        private void oKToolStripMenuItem_MouseDown(object sender, MouseEventArgs e)
            {
                label2.Text = sender.ToString();
                Panel ActivePanel = (Panel)sender;
                foreach (Control ctrl in ActivePanel.Controls)   //Some her is the bug.. and can dont
                {                                                                     //send back it to the panel
                    if (ctrl is Label)
                    {
                        ctrl.Text = "WTF FFS _ ";
                    }
                }
            }


  • leclerc9

    still dont follow - you want to send what back to where

  • sic0198

    I just hope i understand your problem.
    It is normal that second code don't work. Sender of that event is not a panel like in first event. I don't know if you debug at all but here is some code that may help:
    Attach this event handler to ToolStrip and also to all ToolStrip items that are on this toolstrip. I sepose that your toolstrip control is placed in panel control so panel is the parent of toolstrip control.:

    private void toolStrip1_MouseDown(object sender, MouseEventArgs e)
    {
    Panel ActivePanel;
    if (sender is ToolStrip
    )
    ActivePanel = ((
    ToolStrip)sender).Parent as Panel
    ; //if user clicked on empty space of toolstrip control
    else
    ActivePanel = ((ToolStripItem)sender).Owner.Parent as Panel
    ; //if user clicked on some of toolstripitems placed in toolstrip control

    if (ActivePanel != null)
    {
    label2.Text = ActivePanel.ToString();
    foreach (Control ctrl in
    ActivePanel.Controls)
    {
    if (ctrl is Label
    )
    {
    ctrl.Text =
    "OK"
    ;
    }
    }
    }
    }

    All toolstrip items are inherited from toolstripitem so I can use that to cast sender to ToolStripItem and get his owner.



  • Send back "OK" need some help...