Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:28:44+00:00 2026-06-18T06:28:44+00:00

I basically need to do the same thing as in: Get Component's Parent Form

  • 0

I basically need to do the same thing as in:
Get Component's Parent Form

however in compact framework there is no definition of

IDesignerHost

Any idea how to do this?

EDIT:
It is System.ComponentModel.Component derived component that I want to drop on some System.Windows.Forms.Container control.
The reason I need to reference to this is that I don’t want to manually set Parent Container for my component in each form I will drop component to.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:28:45+00:00Added an answer on June 18, 2026 at 6:28 am

    In the Compact Framework a Form’s components are contained inside a member Container variable. There is no direct relation between that Container and the Form itself, other than the fact the Form created the instance. That instance could easily be passed to some other Form or non-Form class, for that matter, and the original parent Disposed.

    What this means is that there is no way to determine the “containing Form” of a Component. That information simply isn’t stored anywhere (well the GC sees the root, but that’s a bit different and not queryable anyway).

    Now if you only want a reference to the IContainer, and not the Form that holds the instance to the IContainer, you can query component.Site.Container, but even that’s got loads of potential holes in it.

    For example, if you drop a SerialPort Component onto a Form, it gets added to the components collection by the designer and serialPort.Site.Container gets set. However, if you drop a Timer Component onto a Form, the Timer is not added to the Components collections, so timer.Site is actually null, so even trying to query the Container would throw a NullReferenceException.

    To make it more fun, Components like the SerialPort also have constructors that allow creation without an IContainer, so while dropping the SerialPort onto a Form in the designer will add it to a Form’s Components, if a developer creates the SerialPort manually, it’s pretty rare that it will get added to the Components collection at all.

    Basically, I think you need to rethink your intended architecture. You’ll have to come up with some mechanism that doesn’t depend on the parent Container.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

basically need to change the value that - admin_url() returns any idea?
I basically need to get user input: gets.chomp(input?) And then to convert the given
I basically need to check if there is an easier way to do this
Basically I need to get older version of a file in the repository without
I'm working on a project that basically does the same thing as strace(1) using
So basically I need to make feature that if you select something from first
Basically what I need is to do something like this App.CommentView = Backbone.View.extend({ className:
Basically need to generate custom(some different then yes no) messeges(alert) in JS , how
I basically need a custom function to be used only when, for example, the
I'm a little lost on moving a div within the dom. I basically need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.