```
private void toolStripButton2_Click(object sender, EventArgs e)
{
        XmlTextReader reader = new XmlTextReader("component.xml");
        XmlDocument doc = new XmlDocument();
        doc.Load(reader);
        string path4 = treeView1.SelectedNode.FullPath.ToString();

        XmlNode nodeToRemove = doc.SelectSingleNode(path4);
        XmlNode parentNode = nodeToRemove.ParentNode;
        parentNode.RemoveChild(nodeToRemove);
 }

```

i use following code for remove node in my xml but it generate following errors. please help me.

this is the part of my xml. i want to remove user selected path Entry. for select path i was generate treeview. variable path4 come from treeview selected path.

```
<WindowEntries>
<WindowEntry>
  <Name>tbwUnitOverview</Name>
  <View>TRN_UNIT</View>
  <LU>TrnUnit</LU>
  <DefaultWindowText />
  <Flags>0</Flags>
</WindowEntry>
<WindowEntry>
  <Name>tbwBrandOverView</Name>
  <View>TRN_BRAND</View>
  <LU>TrnBrand</LU>
  <DefaultWindowText />
  <Flags>0</Flags>
</WindowEntry>
<WindowEntry>
  <Name>tbwProductCategory</Name>
  <View>TRN_PROD_CATEGORY</View>
  <LU>TrnProdCategory</LU>
  <DefaultWindowText />
  <Flags>0</Flags>
</WindowEntry>
<WindowEntry>
  <Name>tbwModel</Name>
  <View>TRN_MODEL</View>
  <LU>TrnModel</LU>
  <DefaultWindowText />
  <Flags>0</Flags>
</WindowEntry>
</WindowEntries>

```

![error window](https://i.stack.imgur.com/FobrZ.jpg) ![error2](https://i.stack.imgur.com/QAjum.jpg)