Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating identical tabs Pin
noahfields14-Feb-04 11:49
noahfields14-Feb-04 11:49 
GeneralRe: Creating identical tabs Pin
noahfields14-Feb-04 14:31
noahfields14-Feb-04 14:31 
QuestionInput Box and Label Null Value? Pin
Eric Houser13-Feb-04 18:09
Eric Houser13-Feb-04 18:09 
AnswerRe: Input Box and Label Null Value? Pin
Mazdak13-Feb-04 19:17
Mazdak13-Feb-04 19:17 
GeneralRe: Input Box and Label Null Value? Pin
Heath Stewart13-Feb-04 20:12
protectorHeath Stewart13-Feb-04 20:12 
GeneralRe: Input Box and Label Null Value? Pin
Mazdak13-Feb-04 20:18
Mazdak13-Feb-04 20:18 
GeneralA child-parent problem... Pin
cemlouis13-Feb-04 13:26
cemlouis13-Feb-04 13:26 
GeneralRe: A child-parent problem... Pin
Bill Dean13-Feb-04 15:39
Bill Dean13-Feb-04 15:39 
Hi,

I think I know the problem.
When you launch the program, you create an instance of the class "parent". But since you do not pass the object to Dialog, you can't refer to it there.

Here's what I did that seemed to produce the effect you want:
1) modify Dialog.cs so that you can store the parent object somewhere. Add this on line 20 or so
<br />
public class Dialog : System.Windows.Forms.Form<br />
<br />
{<br />
	private Form MainForm;  //bill dean says add this!<br />
<br />
	private System.Windows.Forms.Button button1;<br />


2) Modify the constructor for for Dialog so you can pass it a the parent.
<br />
public Dialog(Form frmMain) //bill dean says change here!<br />
{<br />
	//<br />
	// Required for Windows Form Designer support<br />
	//<br />
	InitializeComponent();<br />
<br />
	//<br />
	// TODO: Add any constructor code after InitializeComponent call<br />
	//<br />
	this.MainForm = frmMain; //bill dean says change here!<br />
}<br />
<br />


3) Pass the parent object when you instantiate the form...in Parent.cs
<br />
private void menuItem2_Click(object sender, System.EventArgs e)<br />
{<br />
     Test1.Dialog Dialog = new Test1.Dialog(this); //bill dean says add this.<br />
     Dialog.Show();<br />
}<br />


4) Then (finally!) set the mdiparent for the Child
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
	Test1.Child chform = new Test1.Child();<br />
	chform.MdiParent  = this.MainForm;<br />
	chform.Show ();<br />
}<br />


Hope this helps! I can send you the source code if this post doesn't get the message across... Wink | ;)
Bill
GeneralRe: A child-parent problem... Pin
Kentamanos13-Feb-04 15:55
Kentamanos13-Feb-04 15:55 
GeneralRe: A child-parent problem... Pin
cemlouis14-Feb-04 2:08
cemlouis14-Feb-04 2:08 
GeneralE-mail Validation to clean-up mailing lists Pin
blakeb_113-Feb-04 11:09
blakeb_113-Feb-04 11:09 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
Kentamanos13-Feb-04 12:00
Kentamanos13-Feb-04 12:00 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
Heath Stewart13-Feb-04 12:48
protectorHeath Stewart13-Feb-04 12:48 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
Kentamanos13-Feb-04 13:11
Kentamanos13-Feb-04 13:11 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
blakeb_116-Feb-04 11:18
blakeb_116-Feb-04 11:18 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
Heath Stewart16-Feb-04 11:34
protectorHeath Stewart16-Feb-04 11:34 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
Troy G14-Feb-04 7:34
Troy G14-Feb-04 7:34 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
blakeb_116-Feb-04 8:05
blakeb_116-Feb-04 8:05 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
blakeb_116-Feb-04 9:22
blakeb_116-Feb-04 9:22 
GeneralRe: E-mail Validation to clean-up mailing lists Pin
Member 187126812-Oct-05 18:12
Member 187126812-Oct-05 18:12 
QuestionTransparency killed by task mgr? Pin
Joe Pardue13-Feb-04 10:24
Joe Pardue13-Feb-04 10:24 
AnswerRe: Transparency killed by task mgr? Pin
leppie13-Feb-04 19:08
leppie13-Feb-04 19:08 
GeneralRe: Transparency killed by task mgr? Pin
joepardue14-Feb-04 5:57
joepardue14-Feb-04 5:57 
GeneralInherited form validation issues Pin
RB@Emphasys13-Feb-04 10:23
RB@Emphasys13-Feb-04 10:23 
GeneralRe: Inherited form validation issues Pin
leppie14-Feb-04 19:57
leppie14-Feb-04 19:57 

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.