private void btnAddLink_Click(object sender, EventArgs e) { var edit = new frmEditLink(settings); if (edit.ShowDialog() == DialogResult.OK) { int? From = edit.From, To = edit.To; lstLinks.Items.Add("D" + (From.Value + 1) + " -> D" + (To.Value + 1)); } }
private void btnAddLink_Click(object sender, EventArgs e) { var edit = new frmEditLink(settings); if (edit.ShowDialog() == DialogResult.OK) { int?From = edit.From, To = edit.To; lstLinks.Items.Add("D" + (From.Value + 1) + " -> D" + (To.Value + 1)); } }
private void btnEditLink_Click(object sender, EventArgs e) { try { var edit = new frmEditLink(settings); var vals = (lstLinks.SelectedItem as string).Split(new string[] { " -> " }, StringSplitOptions.None); edit.From = int.Parse(vals[0].Substring(1)) - 1; edit.To = int.Parse(vals[1].Substring(1)) - 1; if (edit.ShowDialog() == DialogResult.OK) { int?From = edit.From, To = edit.To; lstLinks.Items[lstLinks.SelectedIndex] = "D" + (From.Value + 1) + " -> D" + (To.Value + 1); } } catch { } }
private void btnEditLink_Click(object sender, EventArgs e) { try { var edit = new frmEditLink(settings); var vals = (lstLinks.SelectedItem as string).Split(new string[] { " -> " }, StringSplitOptions.None); edit.From = int.Parse(vals[0].Substring(1)) - 1; edit.To = int.Parse(vals[1].Substring(1)) - 1; if (edit.ShowDialog() == DialogResult.OK) { int? From = edit.From, To = edit.To; lstLinks.Items[lstLinks.SelectedIndex] = "D" + (From.Value + 1) + " -> D" + (To.Value + 1); } } catch { } }