private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { if (BadRichTextBox.Lines.Length != 0 || WhiteRichTextBox.Lines.Length != 0) { string gh = string.Empty; gh += "new White applications: " + WhiteRichTextBox.Lines.Length + Environment.NewLine; gh += "new Bad applications: " + BadRichTextBox.Lines.Length; DialogResult dialogResult = MessageBox.Show(gh, "Save changes?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (WhiteRichTextBox.Lines.Length != 0) { File.AppendAllLines(BoxWhite.Text, WhiteRichTextBox.Lines, Encoding.UTF8); WhiteRichTextBox.Clear(); } if (BadRichTextBox.Lines.Length != 0) { File.AppendAllLines(BoxBad.Text, BadRichTextBox.Lines, Encoding.UTF8); BadRichTextBox.Clear(); } } } Process[] pProcess = Process.GetProcessesByName("Excel");// cleanup: for (int i = pProcess.Length; i >= 0; i--) { try { pProcess[0].Kill(); } catch { } } } catch { } }
private void Button7_Click(object sender, EventArgs e) { if (WhiteRichTextBox.Lines.Length != 0) { File.AppendAllLines(BoxWhite.Text, WhiteRichTextBox.Lines, Encoding.UTF8); WhiteRichTextBox.Clear(); } if (BadRichTextBox.Lines.Length != 0) { File.AppendAllLines(BoxBad.Text, BadRichTextBox.Lines, Encoding.UTF8); BadRichTextBox.Clear(); } }