Click here to Skip to main content
15,921,622 members
Home / Discussions / C#
   

C#

 
Questionloop through opened word document c# win app Pin
fady_sayegh27-Dec-05 4:53
fady_sayegh27-Dec-05 4:53 
AnswerRe: loop through opened word document c# win app Pin
Gokulan Venattil27-Dec-05 20:00
Gokulan Venattil27-Dec-05 20:00 
QuestionCustom GUI how they did it? Pin
Antony5227-Dec-05 3:22
Antony5227-Dec-05 3:22 
AnswerRe: Custom GUI how they did it? Pin
VenkataRamana.Gali27-Dec-05 7:32
VenkataRamana.Gali27-Dec-05 7:32 
QuestionInteracting with forms Pin
TomBirkaas27-Dec-05 2:57
TomBirkaas27-Dec-05 2:57 
AnswerRe: Interacting with forms Pin
Colin Angus Mackay27-Dec-05 3:45
Colin Angus Mackay27-Dec-05 3:45 
AnswerRe: Interacting with forms Pin
AB777127-Dec-05 3:46
AB777127-Dec-05 3:46 
AnswerRe: Interacting with forms Pin
peshkunta27-Dec-05 5:47
peshkunta27-Dec-05 5:47 
Hope this helps. I think this is the least confusing method. This is the class of the main form that calls the child form:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PassingDataBetweenForms2
{
public partial class Form1 : Form
{
//Declare an object of Form2 class - the form to be
//called from this form (Form1)
public Form2 ChildForm;

public Form1()
{
InitializeComponent();
}

private void Form1_DoubleClick(object sender, EventArgs e)
{

//Initialize the Form2 class object
ChildForm = new Form2();

//Assign the main form (parent form - of class Form1)
//to the object of class Form1 that is defined in class Form2
//This is the part which creates the link between the two forms
ChildForm.ParentFormObject = this;

//Open/Show the child dialog of class Form2
ChildForm.Show();


}

private void textBox1_Click(object sender, EventArgs e)
{
//When you click in the text box in parent form (Form1 class)
//this assigns a value to a label on the child form (Form2 class)
ChildForm.label1.Text = "This came from the parent form (Form1)";
}
}
}


//*******************************************
//This is the class of the child form
//*******************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PassingDataBetweenForms2
{
public partial class Form2 : Form
{
//Declare an object of the parent form class (Form1)
//Make sure the controls which neet to be assecced from
//the parent form are public, internal,
//or internal protected otherwise you won't be able to
//access them.
public Form1 ParentFormObject;//Same goes for the Form1, Form2 objects

public Form2()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
//This function is executed when the button on
//this form - child form (of class Form2) is pressed.
//This action assigns a value to the textbox of the parent form (Form1 class)
//from this form - child form (Form2 class)
ParentFormObject.textBox1.Text = "Text sent from ChildForm (Form2)";
}
}
}


-- modified at 12:38 Tuesday 27th December, 2005
QuestionHow to add a service in startup Pin
imsathy27-Dec-05 2:55
imsathy27-Dec-05 2:55 
AnswerRe: How to add a service in startup Pin
VenkataRamana.Gali27-Dec-05 7:21
VenkataRamana.Gali27-Dec-05 7:21 
GeneralRe: How to add a service in startup Pin
imsathy27-Dec-05 19:19
imsathy27-Dec-05 19:19 
Questionfind if word doc is already open (c# win app) Pin
fady_sayegh27-Dec-05 2:39
fady_sayegh27-Dec-05 2:39 
AnswerRe: find if word doc is already open (c# win app) Pin
peshkunta27-Dec-05 3:47
peshkunta27-Dec-05 3:47 
GeneralRe: find if word doc is already open (c# win app) Pin
fady_sayegh27-Dec-05 4:27
fady_sayegh27-Dec-05 4:27 
QuestionLinkLabels array Pin
tray_gator27-Dec-05 2:25
tray_gator27-Dec-05 2:25 
AnswerRe: LinkLabels array Pin
gashach27-Dec-05 6:13
gashach27-Dec-05 6:13 
GeneralRe: LinkLabels array Pin
tray_gator27-Dec-05 22:37
tray_gator27-Dec-05 22:37 
QuestionMinimize problem Pin
CoolASL27-Dec-05 2:19
CoolASL27-Dec-05 2:19 
AnswerRe: Minimize problem Pin
peshkunta27-Dec-05 3:15
peshkunta27-Dec-05 3:15 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 18:20
CoolASL27-Dec-05 18:20 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 19:04
peshkunta27-Dec-05 19:04 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 19:43
CoolASL27-Dec-05 19:43 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 20:15
peshkunta27-Dec-05 20:15 
GeneralRe: Minimize problem Pin
CoolASL27-Dec-05 20:21
CoolASL27-Dec-05 20:21 
GeneralRe: Minimize problem Pin
peshkunta27-Dec-05 20:45
peshkunta27-Dec-05 20:45 

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.