How do you guys actually transfer a numeric value in textbox in Form 2 (which is double) to a label in another form(Form 1) in the correct way and this is what I've done:
//Form 2
private void btnok_Click(object sender, EventArgs e)
{
double exchange;
exchange = Double.Parse(txtcurrent.Text);
this.ownerForm.PassValue(txtcurrent.Text);
this.Close();
}
//Form 1
public void PassValue(string strValue)
{
lblexchange.Text = strValue;
}
private void update_Click(object sender, EventArgs e)
{
if (fromcountry.Text == tocountry.Text)
{
MessageBox.Show(" Please Choose Two Different Currencies ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
btnconvert.Enabled = true;
Exchange_Rate frm = new Exchange_Rate();
frm.Show();
}
I got NullReferenceException was unhandled in the end. I don't know how to code it further. I need help