//保存并上传记录 private void button1_Click(object sender, EventArgs e) { try { richTextBox1.SaveFile("./apps.txt", RichTextBoxStreamType.PlainText); Thread.Sleep(1000); sftp.Put("./apps.txt", "/root/applications/" + Cat.userName + DateTime.Now.ToString("yyyy-M-d") + ".txt"); progressbar = 100; } catch { MessageBox.Show("上传失败!"); } }