By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,058 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,058 IT Pros & Developers. It's quick & easy.

Encountering challenges with the Random Function

P: 1
Hello,
I am quite new to programming and picked up VB as a first programming language to learn.
I'm trying to write a program that works with the random function. Its supposed to randomly generate a set of questions I have for the user to answer and has a button with the text Previous on it.
Clicking on it is supposed to show the previously answered question even though it was randomly generated.
Dec 19 '07 #1
Share this Question
Share on Google+
2 Replies


debasisdas
Expert 5K+
P: 8,127
  1. Store all the questions in the database.
  2. Generate a random number between 1 and the total number of questions in the database table.
  3. Using this value move to the particular record and pick the question.
  4. Every time you pick the question using the random number, store it in a variable.
  5. This number can be used to go back to the previous question.
Dec 19 '07 #2

jamesd0142
100+
P: 469
Try using an array and store every question generated in the arrray, then the previous button could just load the latest but 1 question out of the array.
Dec 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.