Quick Search


Tibetan singing bowl music,sound healing, remove negative energy.

528hz solfreggio music -  Attract Wealth and Abundance, Manifest Money and Increase Luck



 
Your forum announcement here!

  Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums > Post Your Free Ads Here in English for Advertising .Adult and gambling websites NOT accepted. > Members' Forums & Blogs

Members' Forums & Blogs Invite Post links to your forums and blogs in here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 03-26-2011, 12:53 PM   #1
tyyq3456642
First Sergeant
 
Join Date: Mar 2011
Posts: 157
tyyq3456642 is on a distinguished road
Default c # subform by value to the parent form

I would like to achieve the following functions: to generate a sub-form the parent form, the body of the text in the box from the window to enter a value, click OK, since the form is closed, and the text box value to the parent form, the parent window This value is used to change their body to a control's content.
online search for a long time I would not find the answer. Which older generation can teach the next
brother, little brother grateful to disrespect.
User Re: is this problem. .
first
form1.cs file another button event and a method.
private void button5_Click (object sender, EventArgs e)
{

Form2 f2 = new Form2 ();
/ / The first method, the form2 to form1 of the setText events GetText (string text) method.
f2.T = new Form2.SetText (GetText);
f2.ShowDialog ();
/ / method 2 in the object to pass form1 form2
Form2 ff = new Form2 (this );
}
public void GetText (string text)
{
string value = text;
}
and is
form2.cs
public partial class file Form2: Form
{
/ / The first method is the agent.
public delegate void SetText (string text);
public event SetText T;
Form1 f1 = null;
public Form2 ()
{
InitializeComponent ();
}
/ / the first 2 methods
public Form2 (Form1 parentForm)
{
this.f1 = parentForm;
InitializeComponent ();
}
private void button1_Click (object sender, EventArgs e)
{
/ / No. 2 method,buy supra shoes uk, where the public can call methods and properties of form1, whatever you like that kind can
f1.GetText (textBox1.Text);
/ / The first method
if (T! = null)
T (textBox1.Text);
this.Close ();
}
}
User response : parent form
C # code


Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

Form2 ff = new Form2 ();
if (ff.ShowDialog () == DialogResult.OK)
; {
; MessageBox.Show (ff.s);
}

subform
C # code


Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

public string s;
private void button1_Click (object sender, EventArgs e)
{
s = this.textBox1.Text;
this.DialogResult = DialogResult.OK;
}

User response: Add a user classes, such as uc.cs, that putting a public static string strVar;
subform button event: uc.strVar = textBox1.Text;
closed after the child form a parent window can receive the variable the value, use the uc.strVar.
User response: winform can directly call the parent form variable. method or control, or upstairs some of the ways to achieve
asp.net refresh the parent form under, and by value in the past to achieve
User response: I have encountered the same problem you had
1 floor is a good idea, there is the thread-safe
is mainform in
public void updataControl (string txt)
{
TextBox1.Text = txt;
}
private void button1_Click (object sender, EventArgs e)
{
SubForm frmSub = new SubForm ();
/ / SubForm frmSub = new SubForm (this ); / / constructor function returns the object
frmSub.frmMain = this;
frmSub.show ();
}
in SubForm
public MainForm frmMain;
private void buttonOK_Click (object sender, EventArgs e)
{
frmMain.updataControl (TextBox1.Text);
this.Close ()
}
so similar
tyyq3456642 is offline   Reply With Quote
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 05:00 PM.

 

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum