Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing an XML file 1

Status
Not open for further replies.

TiltingCode

Programmer
Apr 10, 2009
61
US
I am trying to learn #C 2008 using Windows 7 and have the following code:
Code:
private void btnReadXML_Click(object sender, EventArgs e)
    {
      [COLOR=red]System.IO.StreamReader srXML = new System.IO.StreamReader(@"C:\TestFolder");[/color]
      System.Xml.XmlTextReader xrXML = new System.Xml.XmlTextReader(srXML);
      System.Xml.XmlDocument rXML = new System.Xml.XmlDocument();

      rXML.Load(xrXML);

      label1.Text = rXML.InnerText;

    }
When running in debug on the line I have colored in red execution stops and I get the following message:
Access to the path 'C:\TestFolder' is denied.

Make sure you have suffient privileges to access this resource.

If you are attempting to access a file, make sure it is not read only


I went into the folder and the file and changed all the settings to be permissions to Full control for both of them but still get that message.

Can anyone please help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top