Dim IndividualRecipe As XmlNode

 

IndividualRecipe = doc.SelectSingleNode("descendant::recipe[title='" & lstTitles.SelectedItem & "']")

 

IndividualRecipe.ParentNode.RemoveChild(IndividualRecipe)

 

doc.Save(RecipesFilePath)

 

 

 

'Now remove the deleted recipe from the listbox and textbox:

 

Dim n As Integer = lstTitles.SelectedIndex

lstTitles.Items.RemoveAt(n)

 

If n = lstTitles.Items.Count Then n = n - 1

 

lstTitles.SelectedIndex = n

Call lstTitles_Click(Me, e)