Sunday 15 March 2015

vb.net - Global variable from xml file -



vb.net - Global variable from xml file -

i'm in bit of spot.

i have vb.net module , have xml file have read value value saved global variable.

i know global variables done ussing following.

public shared test string = "balbalbla"

and read in desier form such:

messagebox.show(globalvariables.test)

all wounderfull.

but value xml follows:

public sub my_test() dim xdoc xmldocument = new xmldocument() xdoc.load("c:\test\test.xml") dim test string = xdoc.selectsinglenode("test1/test2").innertext end sub

also great. how varble test in my_test sub become global?

you create globalvariables class

public class globalvariables public shared test string = "" end class

and set :

dim xdoc xmldocument = new xmldocument() xdoc.load("c:\test\test.xml") globalvariables.test = xdoc.selectsinglenode("test1/test2").innertext

xml vb.net global-variables

No comments:

Post a Comment