473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Prevent controls being added to UserControl

Hi

I have a basic UserControl that i want to be able to prevent controls
being added to, i was thinking about catching the ControlAdded event
and then removing the control immediatley after, but was wondering if
there was a better approach.

Cheers

Blu
Nov 21 '05 #1
4 1112
Bludog,

I took some time to make a sample that would fit your previous problem,
however not any reaction on that.

Cor
Nov 21 '05 #2
* BluDog <ne**@nospam.bludog.net> scripsit:
I have a basic UserControl that i want to be able to prevent controls
being added to, i was thinking about catching the ControlAdded event
and then removing the control immediatley after, but was wondering if
there was a better approach.


Just FMI: Why?

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3
On 09 Sep 2004 16:51:36 +0200, hi***************@gmx.at (Herfried K.
Wagner [MVP]) wrote:
* BluDog <ne**@nospam.bludog.net> scripsit:
I have a basic UserControl that i want to be able to prevent controls
being added to, i was thinking about catching the ControlAdded event
and then removing the control immediatley after, but was wondering if
there was a better approach.


Just FMI: Why?


Im a writing a control from scratch that behaves a little like a
treeview, and accepts only controls of a certain type via a collection
property. I want controls only to be added and removed through the
collection. To be honest it makes no odds as the code is only for my
use, but i get these niggly little 'wonder ifs' that i have to
explore!
Nov 21 '05 #4
On Thu, 9 Sep 2004 12:36:12 +0200, "Cor Ligthert"
<no**********@planet.nl> wrote:
Bludog,

I took some time to make a sample that would fit your previous problem,
however not any reaction on that.

Cor


Sorry Cor, your example came after i had resolved it with the help of
another poster. I only later say your post that suggests a similar
solution. Sorry to offend, you help and examples have always proven
extremely valuable.
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tony Maresca | last post by:
Hi. I have a class derived from a UserControl, that I want to allow others to derive controls from. I don't want them to design the base class (which is derived from a UserControl). I know that...
2
by: Ric | last post by:
im new to asp.net. from what i understand, you have the aspx file (presentation), user-control(ascx file), code-behind(vb file) and components(compiled vb and dll files). the aspx file contains a...
11
by: Crirus | last post by:
I need to derive the Windows.Forms.Control 2 times so I design a class like this Public Class BMControl Inherits System.Windows.Forms.UserControl Public Class MapControl Inherits BMControl
7
by: Alon | last post by:
Hi, I'm making my own control which holds some buttons ant textboxes and also has a panel control. in design time i want to drop another controls into the panel that is in my usercontrol. the...
7
by: Fabio Cannizzo | last post by:
How can I prevent a few lines of code contained in the constructor of a Form from being executed by the Designer? Thanks, Fabio
2
by: Joe | last post by:
Hello all, When I drop a control (say a Button) on my user control, the button is added to the parent control of my user control and not my control. For example if my user control is on a panel...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
8
by: Brad Pears | last post by:
I am working on a contract generation application for our log home business. I have a main form that has many controls on it including tabbed controls, panes etc... When the user decides they...
3
by: s.bussing | last post by:
Hi, I have been reading for hours now, but I'm still not able to solve my problem, though a lot of people are struggling with something similar. On my page I have a nested repeater. In the inner...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.