Ok, so, i decided to start playing with some custom components and ran into an interesting, yet rather crippling 'oddity'.
My component works, it gets tossed into the component bin in the IDE and my properties are visibile in the properties list. So far so good.
Since this particular component needs to know it's parent form, i figured "this.Parent".. and what do you know, no such thing.
So, a question and a rant follows:
The question: How can i get the parent form of the component (The parent form clearly sends it it's component container, which ALSO cannot return it's parent, an oddity suddenly changed to plain simple design stupidity in my mind.) Without a doubt the answer will be "use a componentdesigner class" right So much for 'RAD' .. heh.
The rant,
Which IDIOT came up with the idea to let you instantly retrieve parent data from controls, yet, a component is something floating about your application/DLL with no idea where it is 'hosted', same goes for the container that holds it, which is passed to the component from the FORM itself.. There's a lot of 'odd' things in .NET/C#, which is okay, but this is just plain and simple stupidity, at a level unimaginable to me.. whoever decided on this should literally get fired and go work in an entirely different field of work where no computers are required, cause there are some seriously lacking skills present there..
Well, i just had to vent that out.. anyways, if someone could give me a simple answer on how to get the parent form of a component in the parent's component container without having to completely undo the entire concept of RAD by having to code a designer (ludicrous for just getting the parent, you must agree) for the component, that'd be great. Oh, and i do not want to screw with the main app, the component itself must find and set it's host form.
Thanks

Components and their parents
rachid bouzekri
No, you'll have to add the container to the form manually. All dragging and dropping the component is doing is adding some code for you automatically. This auto-generated code doesn't know to call the right constructor. If you just pretty much copy the code it would normally generate for you, and make it call your constructor you should be fine.
Make sure you have this initialization code out of the InitializeComponent procedure, as this procedure is auto-regenerated.
I'm sorry to hear that you're having such difficulties converting, but I think you'll find that it's not your age or the difficulty of C#, but rather just a different way of thinking. Things will seem wrong for a while like "where's my bloody header files " ;-D, but I'm sure you'll get into it before too long.
If you're coming from a C++ background, have you considered C++/CLI instead of C#
robincurry
SaulRodriguez
Unlike a control, a component it not neccesarily hosted in a form, or indeed in any IDE designed thing. It's entirely possible (and likely) that you could use a component in a straight class.
As such it may not have a parent. If you need a parent property you can set one yourself.
Try adding a constructor to your component with the following declaration:
public MyComponent(ContainerControl parentControl)
And then set your internal parent property from here.
Demitry
I have to admit, i rarely have had to deal with a learning curve as steep as plain old C++ to .NET C#, and i design/built airplanes for a living, so i know i have some sort of brain :) There's a lot of stuff in C# that simply doesn't 'stick', i guess it's a sign of me getting a bit older by now sadly.
Thanks
Surixurient
I actually moved to C# because people told me it was easier and more importantly, faster to code with. The 'easier' part is definitely true in some cases, which is a nice thing, the faster part has yet to come :)
I think i'll stick with C# for now, since i do have a kind of 'feel' for it after using it for a while now, it's just the new development practices i have to get used to i guess. Thankfully the internet is full of sample code, tutorials, etc (MSDN is horrible as documentation, but that's a 'tradition' i guess :) ).
Programs like Reflector and IDA Pro which i use a lot to 'peek' at other people's code teach me a lot, i've become rather good at reading IL (which IDA and ILDASM generates) by now :)
Thanks for the help! I guess i'll have to trial and error for some time to come until i get more of an understanding regarding component design and custom control design (even VS2005 lacks some rather important controls after all, i never quite got the 'fact' that the IDE seems to be much more advanced than what VS2005 allows me to use in my code, control-wise).