private void btnSave_Click(object sender, EventArgs e) { var linesCode = txtCode.Lines.ToList(); var linesRegexes = txtRegexes.Lines.ToList(); var linesReplacer = txtReplacer.Lines.ToList(); var countArr = new int[] { linesCode.Count, linesRegexes.Count, linesReplacer.Count }; int maxLineCount = countArr.Max(); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < maxLineCount; i++) { string code = string.Empty; string regex = string.Empty; string repl = string.Empty; if (i < linesCode.Count && i <= countArr[0]) { code = linesCode[i]; } if (i < linesRegexes.Count && i <= countArr[1]) { regex = linesRegexes[i]; } if (i < linesReplacer.Count && i <= countArr[2]) { repl = linesReplacer[i]; } sBuilder.AppendFormat("{0}\t{1}\t{2}{3}", code, regex, repl, Environment.NewLine); } NotepadForm saveDlg = new NotepadForm(sBuilder.ToString()); saveDlg.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { NotepadForm n = new NotepadForm(); n.ShowDialog(); }