Results 1 to 7 of 7

Thread: VB 2005 - Saving To Text File - URGENT HELP NEEDED

  1. #1

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Exclamation 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

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    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?
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    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.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED

    Thanks anyway

  6. #6
    Addicted Member
    Join Date
    Jul 2007
    Location
    Lund, Sweden
    Posts
    145

    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()

  7. #7

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: VB 2005 - Saving To Text File - URGENT HELP NEEDED

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width