怎样将记事本的文档保存阿?用Stream怎样输出到要保存的文件中阿?
private void btnsave_Click(object sender, System.EventArgs e)
{
Stream myStream ;
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "txt files (*.txt)|*.txt" ;
saveFileDialog1.FilterIndex = 2 ;
saveFileDialog1.RestoreDirectory = true ;
string filename=saveFileDialog1.FileName;
if(saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if((myStream = saveFileDialog1.OpenFile()) != null)
{
myStream.WriteByte(byte.Parse(textBox1.Text.ToString()));
myStream.Close();
}
}
}