Click here to Skip to main content
15,897,519 members
Home / Discussions / C#
   

C#

 
GeneralRe: How does a Component get its parent form Pin
James T. Johnson11-Jan-03 0:05
James T. Johnson11-Jan-03 0:05 
AnswerRe: How does a Component get its parent form Pin
James T. Johnson11-Jan-03 0:01
James T. Johnson11-Jan-03 0:01 
GeneralRe: How does a Component get its parent form Pin
leppie11-Jan-03 0:31
leppie11-Jan-03 0:31 
GeneralRe: How does a Component get its parent form Pin
James T. Johnson11-Jan-03 0:42
James T. Johnson11-Jan-03 0:42 
GeneralRe: How does a Component get its parent form Pin
leppie11-Jan-03 1:39
leppie11-Jan-03 1:39 
GeneralRe: How does a Component get its parent form Pin
Anonymous12-Jan-03 3:15
Anonymous12-Jan-03 3:15 
GeneralRe: How does a Component get its parent form Pin
leppie12-Jan-03 6:06
leppie12-Jan-03 6:06 
GeneralRe: How does a Component get its parent form Pin
James T. Johnson12-Jan-03 11:34
James T. Johnson12-Jan-03 11:34 
Anonymous wrote:
I want to get the Form at run time, the code suggested is for design time only

Thats the beauty of it though, the way it works is that at design time it gets assigned a reference to the form. Then when the Form designer goes to generate the code to recreate the component it sees that the property referencing the Form is not equal to the default value (null) so it serializes the property as a reference to the Form.

Even though the code to get the reference happens at design time, the reference is persisted by the designer. Then at run-time, when InitializeComponent is called on the Form it will reassign the reference to match the design-time state of the component.

Unfortunately this does no good if you want an easy solution for non-VS.NET/SharpDevelop users. As far as I know, there isn't any way to get the parent control that is hosting the component. And I'm not sure if there should be either because Components can be used anywhere, not necessarily used in conjunction with a Control/Form.

Sorry if I rambled, or didn't make sense I'm extremely tired and was just about to go to bed when I decided to check my e-mail.

James

"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation

GeneralRe: How does a Component get its parent form Pin
leppie13-Jan-03 6:18
leppie13-Jan-03 6:18 
QuestionToolbar Button Groups? Pin
Jamie Nordmeyer8-Jan-03 8:27
Jamie Nordmeyer8-Jan-03 8:27 
GeneralSpawn a commandline window with environment Pin
kman8-Jan-03 7:05
kman8-Jan-03 7:05 
GeneralRe: Spawn a commandline window with environment Pin
leppie8-Jan-03 7:36
leppie8-Jan-03 7:36 
GeneralRe: Spawn a commandline window with environment Pin
kman8-Jan-03 17:27
kman8-Jan-03 17:27 
GeneralRe: Spawn a commandline window with environment Pin
Daniel Turini8-Jan-03 8:02
Daniel Turini8-Jan-03 8:02 
GeneralCombobox: leaving on enter-key Pin
Nachte8-Jan-03 2:41
Nachte8-Jan-03 2:41 
GeneralRe: Combobox: leaving on enter-key Pin
mikasa8-Jan-03 2:57
mikasa8-Jan-03 2:57 
GeneralBrowser Helper Object Pin
Boris Yankov7-Jan-03 16:12
Boris Yankov7-Jan-03 16:12 
GeneralWindows XP fast user switching Pin
Alex Korchemniy7-Jan-03 13:51
Alex Korchemniy7-Jan-03 13:51 
GeneralString formatting Pin
Le centriste7-Jan-03 9:38
Le centriste7-Jan-03 9:38 
GeneralRe: String formatting Pin
leppie7-Jan-03 9:51
leppie7-Jan-03 9:51 
GeneralRe: String formatting Pin
Le centriste7-Jan-03 11:14
Le centriste7-Jan-03 11:14 
GeneralRe: String formatting Pin
John Burton8-Jan-03 4:26
John Burton8-Jan-03 4:26 
GeneralRe: String formatting Pin
leppie8-Jan-03 6:12
leppie8-Jan-03 6:12 
GeneralHICON's .NET Equivilent Pin
Nnamdi Onyeyiri7-Jan-03 6:29
Nnamdi Onyeyiri7-Jan-03 6:29 
GeneralRe: HICON's .NET Equivilent Pin
leppie7-Jan-03 7:49
leppie7-Jan-03 7:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.