OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = " 请选择您要导入的模板文件:"; openFileDialog.Filter = "TextDocument(*.txt)|*.txt|TextDocument(*.ini)|*.ini"; openFileDialog.ShowDialog(); if (openFileDialog.FileName != "")//判断文件名是否为空 { StreamReader streamReader = new StreamReader(openFileDialog.FileName, Encoding.Default); this.txtextBox.Text = streamReader.ReadToEnd(); }
时间: 2024-10-19 08:42:08