Results 1 to 7 of 7

Thread: Text files

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    New Zealand
    Posts
    39

    Arrow Text files

    I want to open a text file one line at a time and place each line into its own textbox

    Any help would be great

  2. #2
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    something like;

    Dim line As String

    Open FileName For OutPut As #1
    Do Until EOF #1
    LineInput #1, Line
    Text1.Text = Text1.Text + Line
    Line = ""

    Loop
    Don't Rate my posts.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    New Zealand
    Posts
    39
    How do i get the second line into the second textbox

  4. #4
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Well if its only a 2 line Text File

    Dim line As String
    Dim Line2 As String
    'Open the File
    Open FileName For OutPut As #1

    'Get the First Line
    LineInput #1, Line
    Text1.Text = Text1.Text + Line
    Line = ""

    'Get the Second Line
    LineInput #1, Line2
    Text2.Text = Text2.Text + " " + Line2
    Line2 = ""
    Close #1
    Don't Rate my posts.

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    New Zealand
    Posts
    39
    thank you, works great

  6. #6
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    No prop
    Don't Rate my posts.

  7. #7
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    if you want to make your program so it does this with bigger files with more lines in and you dont know how many lines and how many test boxes you are going to need you could use a control array of textboxes to acheive this - just adding text boxes when you need them
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

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