Results 1 to 4 of 4

Thread: League organizer project

  1. #1

    Thread Starter
    New Member samislost's Avatar
    Join Date
    Oct 2009
    Location
    Brighton, United Kingdom
    Posts
    3

    League organizer project

    Hey all im new here and was wondering if anyone could give me a hand with my new project...

    its a League Organizer,

    basicly ive started it off with 16 teams and end up with 1(winner)

    16 box's on the far left, then 8, then 4, then 2, then 1

    the 16 box's have "Team 1" "Team 2" etc...

    ive put a new/clear/open/save button in that order.

    BUT this is my problem..

    when i save(Save Button) the text file saves all the text wrong it ends up like this...

    Team 1Team 2Team 3Team 4 Etc...

    but i want it to save like this

    Team 1
    Team 2
    Team 3
    Team 4
    Etc...
    the code is...

    Code:
    Dim Save As New SaveFileDialog
    Save.Filter = "Text Files (*.txt)|*.txt|ALL FILES (*.*)|*.*"
    Save.Title = "Save File"
    Save.CheckPathExsists = True
    Save.ShowDialog(Me)
    Try
        My.Computer.FileSystem.WriteAllText(Save.FileName, TextBox1.Text, False
        My.Computer.FileSystem.WriteAllText(Save.FileName, TextBox2.Text, True
        My.Computer.FileSystem.WriteAllText(Save.FileName, TextBox3.Text, True
    etc..
    Where am i going wrong?

    Please help, many thanks
    Last edited by samislost; Oct 7th, 2009 at 04:56 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: League organizer project

    You're just appending text each time without adding any line breaks.

    First up, don't call WriteAllText repeatedly. It's very inefficient because you're opening and closing the same file over and over. Either call WriteAllLines once, which will also add line breaks between each element of the array you specify, or else open a StreamWriter and call WriteLine multiple times.

  3. #3

    Thread Starter
    New Member samislost's Avatar
    Join Date
    Oct 2009
    Location
    Brighton, United Kingdom
    Posts
    3

    Re: League organizer project

    ummm im still abit confused could you explain to me how to use WriteAllLines?

    maybe an example?

  4. #4

    Thread Starter
    New Member samislost's Avatar
    Join Date
    Oct 2009
    Location
    Brighton, United Kingdom
    Posts
    3

    Re: League organizer project

    ok ive fixed it, thanks for you help anyways

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