how to write to file

seanjohn_1982

New member
Joined
May 23, 2005
Messages
2
Programming Experience
Beginner
hi all
how do i write data that i get from an instrument(machine) to an notepad file or any file.
thx all
 

razorback

New member
Joined
Oct 28, 2004
Messages
3
Programming Experience
1-3
ok, i found this thread, and its close to what I am needing, but not exactly.
I have two config files, one old, one new. The old config file will be read (for a specific portion <appsettings> thru </appsettings>
all of the lines in that will be written to a file

then I want to open the NEW config file and delete everything between <appsettings> and </appsettings> and insert the Old settings that now resides in a text file, then save the new config file

Is this possible? I can't quite get it...I guess i don'tunderstand how to write to a specific place in the text/config file (aka between <appsettings> and <appsettings> ONLY)

any help is much appreciated.
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
Ok, i'm afraid i don't quite understand your idea but it seems like you need a Split function for manipulating text ... i.e. Dim myText() as String = myString.Split("<aasettings>")

Automaticly, myText(1) is content between these two tags

Happy coding
 

razorback

New member
Joined
Oct 28, 2004
Messages
3
Programming Experience
1-3
kulrom said:
Ok, i'm afraid i don't quite understand your idea but it seems like you need a Split function for manipulating text ... i.e. Dim myText() as String = myString.Split("<aasettings>")

Automaticly, myText(1) is content between these two tags

Happy coding
I tried this, but with the string.split, you can only split on a character, not a string, i.e "<appsettings>"

also, i need what is in between <appsettings> and </appsettings>

this is basically an xmldocument, but i was treating it as text for easier manipulation...maybe I am going about this the wrong way.
 

kulrom

Well-known member
Joined
May 10, 2005
Messages
2,854
Location
Republic of Macedonia
Programming Experience
10+
My bad ... sorry for the confusion :)

Ok this an example how to get only text between those tags

VB.NET:
Dim myString AsString = "<appsettings>content goes here<appsettings>"
  
Dim myArray() AsString = myString.Split("<")
 
Dim myArray2() AsString = myArray(1).Split(">")
 
MessageBox.Show(myArray2(1)) 'result "content goes here"

Regards ;)
 
Top Bottom