public static string Edit( string listText, string title) { if (Instance == null) { Instance = new CriteriaList(); } Instance.Text = title; Instance.ValueList.Text = listText; DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm); if (dr == DialogResult.Cancel) { return(null); } listText = Instance.ValueList.Text; string[] sArray = listText.Split('\n'); List <string> list = new List <string>(); foreach (string s in sArray) { string s2 = s; if (s.IndexOf("\r") >= 0) { s2 = s2.Replace("\r", ""); } s2 = s2.Trim(); if (s2 == "") { continue; } list.Add(s2); } listText = Csv.JoinCsvString(list); return(listText); }
private void EditList_Click(object sender, EventArgs e) { string listText = ValueList.Text; List <string> list = Csv.SplitCsvString(listText); // only comma delimiters allowed here since some values (e.g. names) may contain spaces StringBuilder sb = new StringBuilder(); foreach (string s in list) { sb.Append(s); sb.Append("\r\n"); } string title = Qc.ActiveLabel + " List"; listText = CriteriaList.Edit(sb.ToString(), title); if (listText != null) { ValueList.Text = listText; } return; }