Good Morning - maybe you have another idea?
What I have:
I have created a form. This is the baseform, and another new form is based on this one.
Now I want to prevent controls from being added to the inherited form.
For this I have trapped the ControlAdded-event, and say this.Controls.Remove(e.Control). This works, but I get an error message saying, that the child is not a member ... I understand, that after the ControlAdded-Event some settings are done, but if the control is gone, the changes run into nirvana.
So I have added an async task, which removes the newly created control from the form without errors. But the place, where the control previously was added, is still highlighted, and in the properties-window the removed control is shown.
I have tried to set the focus to another control of the form, but this seems not possible.
Any idea, what I could do? I would prefer to not use the async task, but the eventargs have no cancel-property. I would be content, if I could "select" another control or the form itself in designview?
Many thanks !
What I have:
I have created a form. This is the baseform, and another new form is based on this one.
Now I want to prevent controls from being added to the inherited form.
For this I have trapped the ControlAdded-event, and say this.Controls.Remove(e.Control). This works, but I get an error message saying, that the child is not a member ... I understand, that after the ControlAdded-Event some settings are done, but if the control is gone, the changes run into nirvana.
So I have added an async task, which removes the newly created control from the form without errors. But the place, where the control previously was added, is still highlighted, and in the properties-window the removed control is shown.
I have tried to set the focus to another control of the form, but this seems not possible.
Any idea, what I could do? I would prefer to not use the async task, but the eventargs have no cancel-property. I would be content, if I could "select" another control or the form itself in designview?
Many thanks !