Re: Equivalent to VCL's DataModule



Clive Dixon wrote:
Does the IDE know to look for a private variable of type System.ComponentModel.Container in a CLR object in order to have that object act as a container for other objects at design time ? If not, what is the criteria by which an object at design time can act as a visual container of other objects ?

You can add components to a form or component class even if it doesn't have a container object (try deleting the container object from your wizard generated form or component class and then add components). It's just that if the component you add has a constructor taking IContainer, then VS will add that component to the container object that was created by the wizard - otherwise VS won't add it to the container.

I would assume ever GUI class must have a constructor taking IContainer, else it could not be added to a form, yet when I drop a GUI object onto my component class no code is generated which adds the GUI object to my component class's private container.


I suspect VS's sole criterion for displaying a designer page for a class is that the class derives either from Form or Component, though I don't know for sure.

Since Form derived from Component, perhaps the criterion is that a designer page for a class is displayed if that class is a component or derived from a component.
.



Relevant Pages

  • Re: Button in .aspx form in Visual Basic .net
    ... allow you to move it in the container. ... the default is flowmode which is what ... now what should I do so that at design time any component such ... as button from "Web forms" toolbox can be placed at the convenient location ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Control Container
    ... > be set to runtime as well as design time in a runtime application? ... > can design control page layouts in a runtime application. ... control's Container property. ... Start a new project and put a PictureBox, a Frame, an ImageBox and a ...
    (microsoft.public.vb.controls)
  • Re: Equivalent to VCLs DataModule
    ... object act as a container for other objects at design time? ... is the criteria by which an object at design time can act as a visual ... You can add components to a form or component class even if it doesn't have ...
    (microsoft.public.dotnet.framework)
  • Re: Equivalent to VCLs DataModule
    ... components if it implements System.ComponentModel.Component's constructor which takes a System.ComponentModel.IContainer as a parameter? ... a constructor taking IContainer and calling IContainer.Add, so that if you for example drag drop your component onto a form, VS ensures that your component will be added to the form's Container object. ... Does the IDE know to look for a private variable of type System.ComponentModel.Container in a CLR object in order to have that object act as a container for other objects at design time? ...
    (microsoft.public.dotnet.framework)
  • Re: limited types (Was: Records that could be arrays)
    ... the entire range of elements in the container, ... S derives from type T. That's what "generic algorithm" means. ... types come from different instantiations of some generic container ...
    (comp.lang.ada)