Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


making event to panel that added in running time

Posted on 2005-05-15
Medium Priority
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
  • 2
  • 2
LVL 23

Expert Comment

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

Author Comment

ID: 14005236
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

b1xml2 earned 2000 total points
ID: 14005344
p.MouseMove += new MouseEventHandler(Form1.Panel_MouseMove);

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

Author Comment

ID: 14005391
thnx alot

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

580 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