private void set2_Click(object sender, EventArgs e) { try { value2 = double.Parse(valueTxt.Text); value2Coor = double.Parse(value2txt.Text); //Calculate formula slope = (value2Coor - value1Coor) / (value2 - value1); Yint = value1Coor - (value1 * slope); formulaTxt.Text = "y = " + slope.ToString("f4") + "x + " + Yint.ToString("f4"); value2txt.ReadOnly = true; set2.Enabled = false; } catch { } }
private void set2_Click(object sender, EventArgs e) { try { value2 = double.Parse(valueTxt.Text); value2Calib = double.Parse(value2txt.Text); //Calculate formula slope = (value2Calib - value1Calib) / (value2 - value1); Yint = value1Calib - (value1 * slope); //formulaTxt.Text = "y=" + slope.ToString("f4") + "x+" + Yint.ToString("f4"); formulaTxt.Text = string.Format("y = {0}x + {1}", slope.ToString("f4"), Yint.ToString("f4")); value2txt.ReadOnly = true; set2.Enabled = false; } catch { } }