.NET Framework Bookmark and Share   
 index > .NET Base Class Library > Restrict adding controls in a panel
 

Restrict adding controls in a panel

Hi,
How can i restrict adding controls in a panel at design time. This is for window app in .net 2.0.
Lalit Mohan Sharma
Odd question. This worked well:

using System;
using System.Windows.Forms;

public class MyPanel : Panel {
protected override void OnControlAdded(ControlEventArgs e) {
throw new Exception("nope");
}
}

Hans Passant.
nobugz
Odd question. This worked well:

using System;
using System.Windows.Forms;

public class MyPanel : Panel {
protected override void OnControlAdded(ControlEventArgs e) {
throw new Exception("nope");
}
}

Hans Passant.
nobugz

You can use google to search for other answers

Custom Search

More Threads

• how to convert?
• SqlBulkCopy.WriteToServer - more details from InvalidOperationException?
• How to make random.... random
• IO Permissions
• Active window
• System.OutOfMemoryException when creating a new Thread
• Bug HtmlInputRadioButton ???
• list view
• StreamReader and nulls (\00
• Read URL response thru reader