private void updateButton_Click(object sender, EventArgs e) { // Get the selected distance. Distance d = GetSel(); if (d == null) { MessageBox.Show("You must first select a distance from the list."); return; } Distance dCopy = new Distance(d); using (DistForm dist = new DistForm(dCopy, false)) { if (dist.ShowDialog(this) == DialogResult.OK) { // Change the distance stored in the leg LegFace face = this.CurrentFace; int spanIndex = distancesListBox.SelectedIndex; SpanInfo spanInfo = face.GetSpanData(spanIndex); spanInfo.ObservedDistance = dist.Distance; // Change the displayed distance distancesListBox.Items[spanIndex] = spanInfo.ObservedDistance; m_Edits.UpdateSpan(m_CurFaceIndex, spanIndex, dist.Distance); Rework(); Refresh(spanIndex); } } }