Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
AnswerRe: Print with landscap Pin
Gareth H12-May-08 0:55
Gareth H12-May-08 0:55 
GeneralRe: Print with landscap Pin
cocoonwls12-May-08 7:26
cocoonwls12-May-08 7:26 
GeneralRe: Print with landscap Pin
Gareth H12-May-08 9:05
Gareth H12-May-08 9:05 
GeneralRe: Print with landscap Pin
cocoonwls12-May-08 15:19
cocoonwls12-May-08 15:19 
QuestionPassing Variable to Parent form Pin
benjamin yap11-May-08 23:14
benjamin yap11-May-08 23:14 
AnswerRe: Passing Variable to Parent form Pin
Christian Graus11-May-08 23:17
protectorChristian Graus11-May-08 23:17 
GeneralRe: Passing Variable to Parent form Pin
benjamin yap11-May-08 23:33
benjamin yap11-May-08 23:33 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus11-May-08 23:54
protectorChristian Graus11-May-08 23:54 
If the child form contains this code

public delegate void SendString(string s);
public SendString OnSendString = null;


Then your main form can do this

public void GetString(string theString)
{

}

and in your code that creates the child form:

MyChild dlg = new MyChild();
dlg.OnSendString += new MyChild.SendString(this.GetString);

Then when the child form does this:

if (OnSendString != null) OnSendString("test");

the value "test" is called in GetString in the parent form.

All of this assumes your child form is modeless. If it's modal, then you may as well just assign properties like the other guy said. I assumed that it was modeless from your initial question, you said you want to send something back to the main form. But, if the child form has been closed, then you're not sending anything, properties make more sense in that case.

I can't find the article on communication between forms Frown | :(

Christian Graus

Please read this if you don't understand the answer I've given you

"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

GeneralRe: Passing Variable to Parent form Pin
benjamin yap12-May-08 0:02
benjamin yap12-May-08 0:02 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus12-May-08 0:04
protectorChristian Graus12-May-08 0:04 
GeneralRe: Passing Variable to Parent form Pin
benjamin yap12-May-08 0:10
benjamin yap12-May-08 0:10 
GeneralRe: Passing Variable to Parent form Pin
natsuyaki12-May-08 0:13
natsuyaki12-May-08 0:13 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus12-May-08 0:14
protectorChristian Graus12-May-08 0:14 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus12-May-08 0:13
protectorChristian Graus12-May-08 0:13 
GeneralRe: Passing Variable to Parent form Pin
benjamin yap12-May-08 0:25
benjamin yap12-May-08 0:25 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus12-May-08 0:44
protectorChristian Graus12-May-08 0:44 
GeneralRe: Passing Variable to Parent form Pin
natsuyaki12-May-08 0:51
natsuyaki12-May-08 0:51 
GeneralRe: Passing Variable to Parent form Pin
benjamin yap12-May-08 1:57
benjamin yap12-May-08 1:57 
GeneralRe: Passing Variable to Parent form Pin
natsuyaki12-May-08 2:09
natsuyaki12-May-08 2:09 
GeneralRe: Passing Variable to Parent form Pin
benjamin yap12-May-08 3:02
benjamin yap12-May-08 3:02 
GeneralRe: Passing Variable to Parent form [modified] Pin
natsuyaki12-May-08 3:54
natsuyaki12-May-08 3:54 
AnswerRe: Passing Variable to Parent form Pin
natsuyaki11-May-08 23:18
natsuyaki11-May-08 23:18 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus11-May-08 23:20
protectorChristian Graus11-May-08 23:20 
GeneralRe: Passing Variable to Parent form Pin
natsuyaki11-May-08 23:27
natsuyaki11-May-08 23:27 
GeneralRe: Passing Variable to Parent form Pin
Christian Graus11-May-08 23:46
protectorChristian Graus11-May-08 23:46 

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.