Looping Through XML File VB.NET -
i have xml file :
<?xml version="1.0" encoding="utf-8"?> <!--xml database.--> <disease> <name id="1">info1 <subarticle>info1</subarticle> <mainarticle>info1</mainarticle> <image>info1</image> </name> <name id="2">info2 <subarticle>info2</subarticle> <mainarticle>info2</mainarticle> <image>info2</image> </name> <name id="3">info3 <subarticle>info3</subarticle> <mainarticle>info3</mainarticle> <image>info3</image> </name> </disease>
and have usercontrol :
and have flowlayoutpanel have flowdirection (topdown)
i need make program add new usercontrol in flowlayoutpanel information in xml file examble: program add 3 usercontrol in panel
usercontrol1 = <name id="1"> usercontrol2 = <name id="2"> usercontrol3 = <name id="3">
...etc
how can ?
try this
imports system.xml module module1 const filename string = "c:\temp\test.xml" sub main() dim doc new xmldocument doc.load(filename) dim names xmlnodelist = doc.getelementsbytagname("name") dim diseases new list(of disease) each name xmlnode in names dim newdisease new disease diseases.add(newdisease) newdisease.id = name.attributes("id").value newdisease.text = name.innertext newdisease.subarticle = name.selectsinglenode("subarticle").innertext newdisease.mainarticle = name.selectsinglenode("mainarticle").innertext newdisease.image = name.selectsinglenode("image").innertext next end sub ' <name id="1"> ' info1 ' <subarticle>info1</subarticle> ' <mainarticle>info1</mainarticle> ' <image>info1</image> '</name> end module public class disease public id integer public text string public subarticle string public mainarticle string public image string end class
Comments
Post a Comment