Results 1 to 5 of 5

Thread: [2005] saving techniques

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    51

    [2005] saving techniques

    Hey, I don't really understand save techniques. For starters, here's what I want to be able to do: I have two columns of textboxes, each column containing related data. Whenever the user clicks the a button(save) I want it to save a file somewhere that contains the information in column one and two, but is able to keep them separate. Then, when an open button is pressed, it needs to be able to read each set of data separately and move them each to separate arrays. So how can I do this?
    just you're average programmer/bball player/freshman in highschool...
    http://jjpsnet.com my 'for fun' site

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

    Re: [2005] saving techniques

    Search for StreamWriter in this forum, you will find numerous examples of writing to, and reading from, text files. Considering what you are doing, a text file seems like the way to go. You would basically write each of the items sequentially into the file in a set order. To read it, since you know the order, you just read them back out of the file in the reverse order of how you put them in.
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    51

    Re: [2005] saving techniques

    ok, I understand a little bit about streamwriter now. However, I don't know the number of textboxes at design time; they are dynamically created. When loading the file, how can I distinguish when I'm changing to the other column?
    just you're average programmer/bball player/freshman in highschool...
    http://jjpsnet.com my 'for fun' site

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] saving techniques

    Just make "sections" in your text file. Some text file like this will work
    Code:
    <Left Column>
    this 
    is 
    some
    sample
    </Left Column>
    
    <Right Column>
    123
    456
    789
    </Right Column>
    So when you read the text file line by line, if the line = <Left Colum> then you know that the following lines are text from the textboxes in the left column. You just keep reading them, and for each line, you create a ne textbox for the left column on your form and set its text property = the text of the line. You keep doing this until the line = </Left Column>. Do the same for the right column. With my text file example, you have the left colum with 4 textboxes and the right column with 3 textboxes. Hope you get the idea.

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 2007
    Posts
    51

    Re: [2005] saving techniques

    Yes, that makes sense. So to make sections do I just use little tag things? or is that a line of text?--------never mind I understand.
    Last edited by jjpsnet; Oct 30th, 2007 at 09:26 PM.

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