VB 2005 - Saving To Text File - URGENT HELP NEEDED
---URGENT---
I need some code please that will let me save text from label's and save it into one text file.
Example:
label1, label2, label3
label4, label5, label6
label7, label8, label9 etc...
Also I need some code that will load the text from the text file and back into the label's please :)
So that's saving code and loading code please :)
-----
knxrb
Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED
Search around on this forum for StreamWriter, that ought to get you several examples of saving to text files, and probably a few of reading from them. I have a class I use for all of that, which I posted here a few months ago, but there are many other examples.
The biggest question will be when you save the labels. You would load them all on form load, I would expect, but the saving can happen at any time. How many labels are there?
Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED
Hi, there are 7 labels.
Thanks for the idea, I'll search for streamwriter now :)
-----
knxrb
Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED
I'd post some code, but I'm 3,000 miles away from any, so it just won't be happening. The search should turn up enough answers.
Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED
Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED
Hi, I'm not an expert programmer. But here's a simple example of how to write text to a file. Hope it helps.
Code:
Dim sw As New IO.StreamWriter("textfile.txt", False)
sw.Write(label1.text)
sw.Write(label2.text)
.
.
sw.Flush()
sw.Close()
Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED