CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    24

    [RESOLVED] c# component class help please

    Hi all,
    i am working on a project that i need to create a component class for my project and i want to be able to reach the project from the component class. Furthermore when i drag the component onto the form from the toolbox, i want it to be visible on the form like form controls (buttons, textboxes etc. ) and i want to reach the controls of the parent form which the component added, keeping the parent form's controls private. I used IExtenderProvider interface to reach the parent form's controls but it is not possible at runtime.
    Is there a good way to manage this or would you recommend something better?

    Any help would be appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: c# component class help please

    Quote Originally Posted by izzetbaysal
    Hi all,
    i am working on a project that i need to create a component class for my project and i want to be able to reach the project from the component class.
    What do you mean with 'reach' If you design a component it can have an owner or parent property so you always can have access from your control to the form where it is placed. You can have different events or delegates, interfaces whatever to establish the comm between your control and the project where it is used. You also can use reflection if needed, so whats eactly the problem you have ?
    Never designed a component in before ?
    The article series in the bottom of my signature shows how to design controls / components based on the example of dockable panels.
    Its written for beginners who have never designed any control in before. Shows lots of techniques including hooking, Typeconverter and others. if interested you can go through that stuff. Full code after each article included. Lots of pictures.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  3. #3
    Join Date
    Mar 2008
    Posts
    24

    Re: c# component class help please

    Quote Originally Posted by JonnyPoet
    What do you mean with 'reach' If you design a component it can have an owner or parent property so you always can have access from your control to the form where it is placed. You can have different events or delegates, interfaces whatever to establish the comm between your control and the project where it is used. You also can use reflection if needed, so whats eactly the problem you have ?
    Never designed a component in before ?
    The article series in the bottom of my signature shows how to design controls / components based on the example of dockable panels.
    Its written for beginners who have never designed any control in before. Shows lots of techniques including hooking, Typeconverter and others. if interested you can go through that stuff. Full code after each article included. Lots of pictures.
    First of all thanks for your reply JonnyPoet. My main problem here is creating a component class to communicate between 2 projects. I mean my component class will have a parent form and a child project that the component i created will consist of the configuration of the child project. Because i didn't create the child project as a component(i need to use the child project as a component because i will use it in several forms) and i need to know if i can use the child project as a component by using only a component class.
    Regards.

  4. #4
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: c# component class help please

    Quote Originally Posted by izzetbaysal
    First of all thanks for your reply JonnyPoet. My main problem here is creating a component class to communicate between 2 projects. I mean my component class will have a parent form and a child project that the component i created will consist of the configuration of the child project. Because i didn't create the child project as a component(i need to use the child project as a component because i will use it in several forms) and i need to know if i can use the child project as a component by using only a component class.
    Regards.
    If you create a component, you can use it on a form and it can do whatever the component does for you. But I wouldn't name this a child project. Its a WindowsControplLibrary project and it is separated from your other project as it needs to work with any project where you are using it. You can see all this as mentioned before in my article series about dockable panels. The links are in my signature
    Last edited by JonnyPoet; September 21st, 2008 at 10:45 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #5
    Join Date
    Mar 2008
    Posts
    24

    Smile Re: c# component class help please

    Quote Originally Posted by JonnyPoet
    If you create a component, you can use it on a form and it can do whatever the component does for you. But I wouldn't name this a child project. Its a WindowsControplLibrary projectand it is separated from your other project as it needs to work with any project where you are using it. You can see all this as mentioned before in my artoicle series about dockable panels. The links are in my signature
    Thanks for helping JonnyPoet, i got the idea

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured