Vb net updating xml file
Select Nodes("//Control Center/Monitor/monitor_id") monitorid = node. I then tried creating a dataview pointing to that dataset. Throws exception if file name is not valid Public Sub New(Config File Name As String) _File Name = Config File Name _Monitors Configuration = // Deserialization of the file // _Monitor Index = 0 End Sub Public Property Monitor Index As integer Get return _Monitor Index End Get Set (Value) if (_Monitor Index = value) then return ' you might want to perform check here and allow only valid index _Monitor Index = value _Url Index=0 Notify Property Changed("Monitor Index") Notify Property Changed("Monitor Urls") Notify Property Changed("Has Url") Notify Property Changed("Url Index") End Set End Property Public Read Only Property Has Url As Boolean Get return Not (Monitor Urls Is Nothing Or Else Monitor Urls.count = 0 ) ' ( might be used to disable the listbox bound to Monitor Url ) End Get End Property Public Read Only Property Monitor Urls As List(Of String) Get return _Monitor Configuration(_Monitor Index). I have tried creating a dataset, loading the xmlfile using readxml. They could also choose to add additional urls to the list, or even create an entirely new monitor section. Public Class Monitors Configuration VM Implement INotify Property Changed ' creates a new VM. "Rocky" wrote: The following code should compile just fine (provided that you have text Box1 and text Box2 Text Boxes on your form): Try Dim file Name As String = "my File.xml" Dim user Name As String = text Box1. Text Dim xml Doc As Xml Document = New Xml Document xml Doc.
Net XML library to add nodes into it and then save the result into a file (string or stream)... When I click submit, i want to add whatevers in the text box1 as username and whatevers in textbox2 as userid into an xml file. Load(file Name) Dim x Path As String = ""//user[@name='" & text Box1. Save("C:\test.xml") HTH Nigel Armstrong "Maileen" wrote: I've discovered where was the mistake. Select Single Node("//DB/DB_Loc") ' your example implies that DB is not the root element... Net XML library to add nodes into it and then save the result into a file (string or stream)... When I click submit, i want to add whatevers in the text box1 as username and whatevers in textbox2 as userid into an xml file. Load(file Name) Dim x Path As String = ""//user[@name='" & text Box1. Alternatively, you could create an XML document and use . My xml file look like this: Not sure what are your rules to pick a file, but if you need to update an existing xml file you could use something similar to the following: Dim xml Doc As Xml Document = New Xml Document() xml Doc. Select Single Node(x Path) If node Is Nothing Then node = xml Doc.