Click here to Skip to main content
15,894,540 members
Home / Discussions / C#
   

C#

 
AnswerRe: Best Practice: Internet Connection? Pin
Mazdak14-Feb-04 4:02
Mazdak14-Feb-04 4:02 
GeneralRe: Best Practice: Internet Connection? Pin
Troy G14-Feb-04 4:06
Troy G14-Feb-04 4:06 
AnswerRe: Best Practice: Internet Connection? Pin
visiontec14-Feb-04 8:34
visiontec14-Feb-04 8:34 
GeneralRe: Best Practice: Internet Connection? Pin
Nick Parker14-Feb-04 9:29
protectorNick Parker14-Feb-04 9:29 
GeneralRe: Best Practice: Internet Connection? Pin
Troy G14-Feb-04 12:46
Troy G14-Feb-04 12:46 
Generalsomething wrong with my ADO.net Pin
ASGill14-Feb-04 2:53
ASGill14-Feb-04 2:53 
GeneralRe: something wrong with my ADO.net Pin
Mazdak14-Feb-04 4:05
Mazdak14-Feb-04 4:05 
GeneralReadFile error Pin
Member 57829113-Feb-04 21:30
Member 57829113-Feb-04 21:30 
GeneralRe: ReadFile error Pin
Heath Stewart14-Feb-04 9:17
protectorHeath Stewart14-Feb-04 9:17 
GeneralReadFile error Pin
Lots13-Feb-04 21:30
Lots13-Feb-04 21:30 
GeneralCreating identical tabs Pin
noahfields13-Feb-04 19:06
noahfields13-Feb-04 19:06 
GeneralRe: Creating identical tabs Pin
Heath Stewart13-Feb-04 20:15
protectorHeath Stewart13-Feb-04 20:15 
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 

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.