Shaddow Posted February 9, 2004 Posted February 9, 2004 XML File Processing Question... For Each Node In XmlDocument.Item("configuration").Item("appSettings") If Node.Name.ToString = "add" Then MsgBox(Node.Attributes.GetNamedItem("key").Value.ToString) End If Next Node the file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="inputGoogleKey.Text" value="" /> <add key="cbxBroadband.Checked" value="False" /> <add key="cbxTopMost.Checked" value="False" /> <add key="txtRecentFile0.Text" value="" /> <add key="txtRecentFile1.Text" value="" /> <add key="txtRecentFile2.Text" value="" /> <add key="txtRecentFile3.Text" value="" /> </appSettings> </configuration> What happens is that the messagebox seems to repeat the file multiple times. finally the messagebox get's weird and then it'll finally close. any ideas? my brain is feeling foggy.... Quote
mocella Posted February 11, 2004 Posted February 11, 2004 I created a project called "XMLProcessor", added an app.config with the info you specified in your question, then ran this code: Dim Node As XmlNode Dim XMLDocument As XmlDocument = New XmlDocument XMLDocument.Load("XMLProcessor.exe.config") For Each Node In XMLDocument.Item("configuration").Item("appSettings") If Node.Name.ToString = "add" Then MsgBox(Node.Attributes.GetNamedItem("key").Value.ToString) End If Next Node It ran just fine - I called it in a button_click event. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.