请删除错误,并详细说明我在其中做错了什么 [英] remove bugs please , and explain in detail what wrong thing i was doing in it

查看:82
本文介绍了请删除错误,并详细说明我在其中做错了什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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>
--

推荐答案

System.IO.StreamReader''不包含"close"的定义
由于错误消息指出System.IO.StreamReader没有关闭"方法.您刚刚用"C"大写字母弄错了.它是关闭"

System.IO.StreamReader'' does not contain a definition for ''close''
As error message is stating System.IO.StreamReader does not have "close" method. You have just made mistake with Caps "C". it''s "Close"

strmEditFile.Close();



谢谢



Thanks


这篇关于请删除错误,并详细说明我在其中做错了什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆