Access to a master form, from a component class

Reply

Join Date: Nov 2008
Posts: 1
Reputation: msd1357 is an unknown quantity at this point 
Solved Threads: 0
msd1357 msd1357 is offline Offline
Newbie Poster

Access to a master form, from a component class

 
0
  #1
Nov 16th, 2008
Hello,
I create a component class in Visual Studio 2008 in a windows form application. This component has a property named "MasterFormName", which should contain name of the form that component will place on it. I want that the MasterFormName property be a read only property and when I dragging it to my form at design time, it automatically take the master form name that contains the component, without directly writing by user. How could I achieve this ability? I think that I should found a way to access any master form from the component class, But how do this?
Regards…
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 9
Reputation: MRafeie is an unknown quantity at this point 
Solved Threads: 0
MRafeie MRafeie is offline Offline
Newbie Poster

Re: Access to a master form, from a component class

 
0
  #2
Nov 16th, 2008
Hi
You can use the ParentForm property of your component easily. For example:
this.MasterFormName = this.ParentForm.Name;
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 9
Reputation: MRafeie is an unknown quantity at this point 
Solved Threads: 0
MRafeie MRafeie is offline Offline
Newbie Poster

Re: Access to a master form, from a component class

 
0
  #3
Nov 17th, 2008
Hint: If you drag your component on to another control (any thing else a Form) you will recieve a null exception error.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC