Click here to Skip to main content
15,917,926 members

Comments by Zachary.shupp (Top 71 by date)

Zachary.shupp 10-Nov-13 10:58am View    
Okay so I fixed that error by modifying the code a little. the issue Im having now is the way its writing the category, it puts selected attribute before the Name attribute. Is there something im doing wrong in the code.

Dim xmlSettings As New XmlDocument
xmlSettings.Load(sPath)

Dim root As XmlNode = xmlSettings.SelectSingleNode("/AdminLaunch/Categories")
Dim xNode As XmlNode = xmlSettings.CreateElement("Category")
Dim xName As XmlAttribute = xmlSettings.CreateAttribute("Name")
Dim xSelected As XmlAttribute = xmlSettings.CreateAttribute("Selected")

xName.Value = "Scripts"
xSelected.Value = "True"

xNode.Attributes.Append(xName)
xNode.Attributes.Append(xSelected)

root.AppendChild(xNode)

xmlSettings.Save(sPath)
Zachary.shupp 10-Nov-13 9:41am View    
When I run it I get "Expression must evaluate to a node-set".
Zachary.shupp 9-Nov-13 23:34pm View    
I have been looking through System.Xml.XmlDocument and I see that I have to load it to memory and then modify it then save it back to the file. below is the function Im trying to get working and I still need a little help.

Dim nLine As String = Environment.NewLine
Dim newTool As String = I cant get my string to save in this comment
Try
' Load the XmlDocument.
Dim xd As New XmlDocument()
xd.Load(sPath)

Dim docFrag As XmlDocumentFragment = xd.CreateDocumentFragment()
docFrag.InnerXml = newTool
Dim root As XmlNode = xd.SelectSingleNode("/AdminLaunch/Categories/")
root.AppendChild(docFrag)

xd.Save(sPath)
Return True
Catch ex As Exception

MsgBox(ex.Message)
End Try
Zachary.shupp 29-Jul-13 15:36pm View    
What information is in $objAusgabe?
Zachary.shupp 29-Jul-13 7:53am View    
I am using system.windows.forms to create the GUI interface.