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

C#

 
Questionsolve this error Pin
salil_k_singh12-May-08 1:20
salil_k_singh12-May-08 1:20 
AnswerRe: solve this error Pin
Anthony Mushrow12-May-08 1:26
professionalAnthony Mushrow12-May-08 1:26 
AnswerRe: solve this error Pin
ScottM112-May-08 1:34
ScottM112-May-08 1:34 
QuestionStrongName Question Pin
William Ten Broek12-May-08 1:20
William Ten Broek12-May-08 1:20 
AnswerRe: StrongName Question Pin
tgrt12-May-08 3:52
tgrt12-May-08 3:52 
GeneralRe: StrongName Question Pin
William Ten Broek12-May-08 10:24
William Ten Broek12-May-08 10:24 
QuestionFile attributes Pin
ScottM112-May-08 0:44
ScottM112-May-08 0:44 
AnswerRe: File attributes Pin
Anthony Mushrow12-May-08 1:28
professionalAnthony Mushrow12-May-08 1:28 
AnswerRe: File attributes Pin
Ashfield12-May-08 1:29
Ashfield12-May-08 1:29 
AnswerRe: File attributes Pin
MoustafaS12-May-08 2:28
MoustafaS12-May-08 2:28 
QuestionHelp with web services in C# Pin
WebMaster12-May-08 0:26
WebMaster12-May-08 0:26 
AnswerRe: Help with web services in C# Pin
Anthony Mushrow12-May-08 1:32
professionalAnthony Mushrow12-May-08 1:32 
GeneralRe: Help with web services in C# Pin
WebMaster12-May-08 6:41
WebMaster12-May-08 6:41 
GeneralRe: Help with web services in C# Pin
Anthony Mushrow12-May-08 6:45
professionalAnthony Mushrow12-May-08 6:45 
QuestionPrint with landscap Pin
cocoonwls12-May-08 0:25
cocoonwls12-May-08 0:25 
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 

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.