March 2nd, 2000, 08:28 AM
l want to create a program that contains six question with four options button, on each of them(like a multi chose). But the problem is that l want to store 20 store questions & select six of these at random. How this done?
|
Click to See Complete Forum and Search --> : Option Buttons March 2nd, 2000, 08:28 AM l want to create a program that contains six question with four options button, on each of them(like a multi chose). But the problem is that l want to store 20 store questions & select six of these at random. How this done? AndyK March 2nd, 2000, 02:39 PM Use RANDOMIZE function to randomize your 20 questions. Other then taht please explain a little bit more of what exactly you want March 2nd, 2000, 10:10 PM Off the top of my head... public function SelectRandomQuestions() dim question as integer, x as integer, qu(1 to 6) as integer, y as integer dim q(1 to 6) as string randomize for x = 1 to 6 'Pick six questions question = rnd*20 'randomly out of 20. if question = 0 then question = 1 for y = 1 to 6 'no duplicates... if qu(y) = question then do while qu(y) <> question doevents question = rnd * 20 loop end if next y qu(x)=question select case question case 1 q(x)="Question 1" case 2 q(x)="Question 2" case 3 q(x)="Question 3" case 4 q(x)="Question 4" case 5 q(x)="Question 5" case 6 q(x)="Question 6" case 7 q(x)="Question 7" case 8 q(x)="Question 8" case 9 q(x)="Question 9" case 10 q(x)="Question 10" case 11 q(x)="Question 11" case 12 q(x)="Question 12" case 13 q(x)="Question 13" case 14 q(x)="Question 14" case 15 q(x)="Question 15" case 16 q(x)="Question 16" case 17 q(x)="Question 17" case 18 q(x)="Question 18" case 19 q(x)="Question 19" case 20 q(x)="Question 20" end select next x end function There! You'll have six random questions - q(1) ... q(6). -Rich Morgan rich@cheap-price.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |