Results 1 to 4 of 4

Thread: how to move next line in text files

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Location
    Birmingham UK
    Posts
    50

    Unhappy

    can anyone help me as I feel i am a bit too thick I have design a quiz using a text file ( Thats where the data is save) the problem is how do i move on to the next line and how can i check if the question is right here is a example

    Question : Who is Bill Gate

    answer a) owner of MS
    b) rich ass hole
    c) don't care


    ok we know the correct answer is a but how do i load this up in a option box or a u know the question is how to i move on to the next question until it is the end of the file ...... email me on [email protected] please

    Waheed Rafiq (ICT Technician):
    Network +

  2. #2
    Addicted Member Mage33's Avatar
    Join Date
    Aug 2000
    Location
    Petaluma, California
    Posts
    138

    Um.... uh...

    I don't exactly understand your question but I think I might. Your using a .ini file to store questions and their possible answers, right? So, what I'd do, is go to the tutorials area of this web site, do a search for how to read a .ini file, make a list in your program of the names of the questions and then just go through that list, having those names being the same names you use for the questions in the .ini file.
    At least... I think that's what you mean, hope this helps!
    Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
    -ShardsOfSilence.net- ^ My name in ASCII ^
    You forget something new every day
    | WinME | VB6 Pro | MSC++ | Lambda MOO |

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Code:
    Open QuizFile For Input As #1
       Do While Not(EOF(1))
          Line Input #1, QandA
       MsgBox QandA
       Loop
    Close
    This will loop trough every line in the textfile and display each line in a msgBox, it would be the best to store the answers/questions like

    Who's tha man? Jop,You,Me

    And use the split function (if you're using VB6) to split the ,(the Answers) and a space (the Question)

    You could load them in a ComboBox then by doing
    Code:
    'Loop trough available answers (you have to code it yourself :)
    For Answer1 To Answer3
        ComboBox1.AddItem Answers
    '(can't test it now, look at the variables to check wich one)
    Next Answer1
    You could also store the A's in an array
    Hope it helped a bit.
    Add me for more info (18818940)
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Addicted Member Mage33's Avatar
    Join Date
    Aug 2000
    Location
    Petaluma, California
    Posts
    138

    Eep!

    Waste of code , use an initiation file unless security is really an issue.
    Stephen Haney- 115 116 101 118 101 31 72 65 78 69 89
    -ShardsOfSilence.net- ^ My name in ASCII ^
    You forget something new every day
    | WinME | VB6 Pro | MSC++ | Lambda MOO |

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