vb.net - dynamically addressing xml document fields -


i using visual basic application generate , manage data @ same time loaded webpage.

i have chosen through xml seemed path of least resistance.

this not standard xml file, pretty each element has unique name can referenced both vb app , webpage make sure data can correctly identified in both cases. due complexity of data need able reference fields dynamically

example

textbox controls each have unique names correspond xml element load data to

textbox name = xml.<root>.<name> textbox age = xml.<root>.<age> textbox height = xml.<root>.<height> 

the idea update function same textboxes , identify xml element according name of control updated:

xml.<root>. & control.name = control.value 

but i'm not quite able work out if similar possible.

you have use bindingsource bind data xml controls shown below.

look below code, comments explain content

input:

<root>     <name>kumar kumar</name>     <age>28</age>     <height>6</height>  </root> 

code:

       'declare binding source         dim bs bindingsource = new bindingsource()          'decalre dataset read xml         dim ds dataset = new dataset()          'load dataset xml         ds.readxml("c:\\users\\xxxxx\\desktop\\test\\test.xml")          'bind dataset bindingsource has loaded xml         bs.datasource = ds         bs.datamember = ds.tables(0).tablename          'this important bind controls memebers of binding source         'the first parameter of add, "text" attribute of text block         'second parameter of add, binding source         'third parameter xml attribute bound         textboxname.databindings.add("text", bs, "name")         textboxage.databindings.add("text", bs, "age")         textboxheight.databindings.add("text", bs, "height") 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -