making event to panel that added in running time

Posted on 2005-05-15
Last Modified: 2010-04-16
 in my program i add Panels in this way
              Panel p = new Panel();
               // set properties
               p.Top = 0;
               p.Left =0;
               p.Height =100;
               p.Width = 100;
               p.BackColor = Color.Red ;
               //add the panel
in my MouseMove Event of these Panels, How can i check the properties of the panel i am making an event on it.

the compiler write to me that the namespace couldn't be found, because i am adding panels in running time and not in design time

Question by:madmare
    LVL 23

    Expert Comment

    then go explicit:
    System.Windows.Forms.Panel p = new System.Windows.Forms.Panel();

    Author Comment

    i am adding more than one panel by this way, all these panels have the same name because i am adding by Button_Click event, the problem is by the MouseMove event on one of these panels, becuase i haven't add it in design time the compiler write to me that the namespace couldn't be found.
    LVL 23

    Accepted Solution

    p.MouseMove += new MouseEventHandler(Form1.Panel_MouseMove);

    private void Form1_MouseMove(object sender, MouseEventArgs e)
      Panel p = (Panel)sender;                  

    Author Comment

    thnx alot

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now