Hi,
I hav two user control's in my windows form application. In the first user control i have one "textbox" and one "save" button.
I have another "Textbox" in another user control.
when i click "save" button then what ever the value in "textbox" in user control one has to display in another user control "Textbox".
I have tried like this
namespace project
{
public partial class ucSample : UserControl
{
private double transferVolume;
public double TransferVolume
{
get { return transferVolume; }
set { transferVolume = value; }
}
public ucSample()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
TransferVolume = double.Parse(txtSamplevolume.Text);
}
}
}
In another user control i am trying like as shown below.
namespace project
{
public partial class ucSettings : UserControl
{
ucSample samplevolume = new ucSample();
public ucSettings()
{
InitializeComponent();
}
private void txtvolumeMin_TextChanged(object sender, EventArgs e)
{
txtvolumeMin.Text = samplevolume.TransferVolume.ToString();
}
}
}
Please can any one help me what mistake i am doing here. I am using property to transfer value. I am not able figure it out what is the mistake. or any other best way to do this .
Thanks in advance.