Results 1 to 5 of 5

Thread: VB Quiz help

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    3

    VB Quiz help

    hi guys,
    im new to this forum and have a problem.im makeing a vb program which is a quiz.i am trying to import .dat file into a label and 4 opt boxes which are an array.however on numerous attempts im not having any luck.i even tried makeing a page in vb where i can type questions and they are imported into a .dat file but it doesn't seem to work..i thought my best option was to get help from a forum. I have to hand in the program tommorow for an assignment. to see my problem you can download it from www.flashbannerz.com/files/visualbasic.zip . i hope someone can look at this and help me solve my problem.

    thanks alot,

    regards

    jon

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB Quiz help

    You should post the problem that you are having, as well as some code that is causing you problems. Not too many people will download code, and run it to see what is the matter with it, and then fix it for you. Nor will we grade your app. We wil be glad to help, but you also have to help yourelf.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    3

    Re: VB Quiz help

    sorry i didnt think if i posted code it would help.the code is as follows

    Private Sub cmdNext_Click()
    Dim filename As String
    Dim Index As Integer

    filename = App.Path & "\Question.dat"
    Open filename For Random As #1 Len = Len(MyQuestion)
    Get #1, 1, MyQuestion
    Close #1
    lblQuestion.Caption = MyQuestion.Question
    For Index = 1 To 4
    opt1(Index).Caption = MyQuestion.Answer(Index)
    Next Index
    End Sub

    i have created a .dat file.in the .dat file the following information is displayed.

    s  a c v w

    this puts an s in the label part of the program and a,c,v,w in the 4 opt boxes in the array,however when i try and change this i get the following error.

    run time error 59'
    bad record length

    i even just tried changing 1 letter to the following

    s  a c b w

    i changed the v to a b but still ger the same error message.is there any way around this..

    i dont understand why this is happening.i would like to be able to put the question in the .dat file and the 4 answers in the opt box array.there are 4 opt boxes in this array.

    can you help as i dont understand why this is happening

    thanks again,

    jon

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB Quiz help

    that's where you write the file. i don't think you need a random accsss file for something like a simple test. you should just use a sequential file. that way, you can read whatever format that you write. i'd also read the test into an array.

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB Quiz help

    well, i was going to look at your program, but got a 404 file not found error.
    If you want to read 6 variables, write 6 to get the length. and you don't need random files. Good Luck, but you shouldn't wait so long to work on a project.

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