Re: Equivalent to VCL's DataModule by Edward
Edward
Fri Mar 24 16:49:38 CST 2006
Stephany Young wrote:
> Why is it misleading?
>
> It is a class that inherits Component. Nothing more, nothing less.
You are right. I guess the ability that it has to visually contain other
components fooled me into thinking it was something special.
So I will ask a couple of more questions.
Can any component derived class serve as a container for other
components if it implements System.ComponentModel.Component's
constructor which takes a System.ComponentModel.IContainer as a parameter ?
Unlike VCL's DataModule all of the contained components are declared
private in the class, which means that they are not accessible outside
of the class. What waa the reason for that ?
I noticed that my component will only visually accept non-GUI components
to be embedded within it in the IDE. That is what I want, but I was
wondering what controls that, especially as the
System.ComponentModel.IContainer accepts any IComponent interface ?
>
>
> "Edward Diener" <eddielee_no_spam_here@tropicsoft.com> wrote in message
> news:uGzWEm2TGHA.2156@tk2msftngp13.phx.gbl...
>> Clive Dixon wrote:
>>> Sounds like you could be thinking of a "component class". In VS 2003 if I
>>> right click on my project, select Add -> Add Component and select
>>> Component Class. VS then gives you a C#/VB/C++ class with a "designer
>>> page" onto which you can drag drop components and set their properties in
>>> the same way as for UI controls on a form. Is this the kind of thing
>>> you're looking for?
>> Bravo ! Yes. I knew MS had to be smart enough to include something like
>> this in .NET. I guess I should have found it previously, but thanks for
>> bringing it to my attention and seeing this is what I was asking for.
>>
>> The name is a bit misleading to me. I would have preferred it to be called
>> a component container or even a data container since I am guessing I can
>> add non-component value data manually to it also.
>>
>>> "Edward Diener" <eddielee_no_spam_here@tropicsoft.com> wrote in message
>>> news:OCiOYO0TGHA.2244@TK2MSFTNGP14.phx.gbl...
>>>> In Borland's VCL ( Visual Component Library ), one can use a DataModule
>>>> into which one can drop non-visual components from the RAD designer. The
>>>> DataModule is a design-time visual container for non-GUI components,
>>>> which is never seen visually at run-time as a GUI control. An
>>>> application or Dll can have any number of datamodules in it, each with
>>>> its own name. One can also manually add any non-GUI data to any
>>>> particular DataModule. For an application at run-time, datamodule
>>>> instances for each visual datamodule are automatically created just like
>>>> forms, while for a Dll at run-time it is the programmer's responsibility
>>>> to create datamodule instances for each visual datamodule created at
>>>> design time.
>>>>
>>>> I have found the ability to use datamodules as visual containers to
>>>> non-GUI components in an application or Dll to be very useful.
>>>> Admittedly a datamodule is nothing more than a class which contains
>>>> instances of non-GUI components and possibly other non-GUI fields, but I
>>>> like the ability to manipulate it at design time, and as a means of
>>>> separating the data portion of an application or Dll from the GUI
>>>> portion.
>>>>
>>>> Does .NET have any equivalent to this idea, so that non-visual
>>>> components can be created at design time without having to drop such a
>>>> component on a Windows or Web form. ?
>