首页 > 代码库 > openFileDialog与saveFileDialog的使用

openFileDialog与saveFileDialog的使用

private void btnOpen_Click(object sender, EventArgs e)        {            if (openFileDialog1.ShowDialog() == DialogResult.OK)            {                string fileName = openFileDialog1.FileName;                txtInfo.Clear();                txtInfo.Text = File.ReadAllText(fileName);            }        }        private void btnSave_Click(object sender, EventArgs e)        {            if (saveFileDialog1.ShowDialog() == DialogResult.OK)            {                string fileName = saveFileDialog1.FileName;                File.WriteAllText(fileName, txtInfo.Text);            }        }

 

openFileDialog与saveFileDialog的使用