CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: visual basic

  1. #1
    Join Date
    Apr 2001
    Location
    maharashtra,india
    Posts
    12

    visual basic

    I am doing a project on online examination. I have entered data (questions) into the database. I would be thankful if anybody can suggest the code for automatically radom selection of questions when a student appears for the test.

    Thanks.


  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: visual basic

    I fyou have an autoincrement field in your database, then it is easy.

    Determine a random number using

    QNo = Int (Rnd*NoOfQuestions)+1

    Then use FindFirst to determine the record with this number in the ID field

    But it might result in the same question number being repeated again. To prevent this


    dim UsedNum as string

    for i=1 to 10 'to select ten questions
    do
    QNo = Int (Rnd*NoOfQuestions)+1
    Loop until Instr(UseNum, QNo & ", ")=0
    UsedNum = UsedNum & QNo & ", "
    'Do other work here
    next





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

Featured