Question:

How do you put 2 lines in txt file into 2 diff. textboxes in visual basic 6?

by  |  earlier

0 LIKES UnLike

e.g. Inside text file:

7.30 pm

8.00 pm

How do i put the first line in one text box and the second in the other? i can't be bothered to learn databases right now, or create separate files for each line, so i'm sticking to text files to store my data.

e.g. roughly looks like this:

________

| 7.30 pm | <-- text1 (textbox)

---------------

________

| 8.00 pm | <--text2 (another textbox)

---------------

please provide code, or at least a useful link.

this is an example of what i already know about inputting data from txt files into textboxes:

Open App.Path & "\demo1.txt" For Input As #1

Text1.Text = Input(LOF(1), #1)

Close #1

please try to relate to this format

thanks in advance

 Tags:

   Report

1 ANSWERS


  1. Hi

    Try this:

    Dim c as Integer

    Dim X as String

    c=1

    Open Add.path &amp; &quot;\demo1.txt&quot; For Input As #1

    Do While Not EOF(1)

    Line Input #1, X

    if c = 1 then

    Text1.Text = X

    else

    Text2.Text = X

    End If

    c = c + 1

    Loop

    There are probably better ways to do this but I hope this helps

    Regards

    G

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions