本文介绍了请删除错误,并详细说明我在其中做错了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<b>Error 1 System.IO.StreamReader' does not contain a definition for 'close' </b> ...is that so . update this with the correct code..
//
if(!Page.IsPostBack)
{
StreamReader strmEditFile;
try{
//Open the file
strmEditFile = File.OpenText(strPath + "\\" + strFile);
//Read its text
txtEditFile.Text = strmEditFile.ReadToEnd().ToString();
//Close the file.
strmEditFile.close();
}
catch(FileNotFoundException ex)
{
// If it does not exists . create it.
File.CreateText(strPath + "\\" + strFile).Close();
//Clear the text Box
txtEditFile.Text = "";
}
catch(System.UnauthorizedAccessException ex)
{
Server.Transfer("NotAuthorized.aspx");
}
<b><u>
and u 9 what catch block is also showing error that ex(object) is declared but not used here ,,,,
Please guide as earliest as possible</u></b>
--
推荐答案
strmEditFile.Close();
谢谢
Thanks
这篇关于请删除错误,并详细说明我在其中做错了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!