المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Set the parent textbox value from child form



C# Programming
01-14-2010, 08:50 AM
Hi,

I am developing one application in that one parent form is there if i click on button it will open child form. Now i want to transfer data from child form to textbox in parent form.
I have tried the following code.
private string childMessage;
ChannelingServices.Cs(Parent)
public string ChildMessage
{
get { return childMessage; }
set { childMessage = value; }
}
public void UpdateMessage()
{
doctorid = ChildMessage;
txtDoctorId.Text = doctorid; //This is the destination textbox
}

private void btngetchilddata_Click(object sender, EventArgs e)
{
DoctorSearchWizard doctorsearch = new DoctorSearchWizard();
doctorsearch.Show();
this.Close();
}
DoctorSearchWizard.Cs(Child)
private void btnapply_Click(object sender, EventArgs e)
{
ChannelingServices.ChildMessage = txtdata.Text;
ChannelingServices.UpdateMessage();
}
But while debugging its UpdateMessage method showing value in textbox but after execution in form it doesn't contains any value in textbox.
Please tell me how to solve this problem.Or can you please suggest me how to pass data from child to parent textbox in form.


Thanks&Regards
Pavani