locked
Quotes RRS feed

  • Question

  • What is the best way/and how to put quotes / bible verses in a textbox or label on main form to show random quotes or bible verses when the program is starting.

    Thursday, March 20, 2008 7:00 AM

Answers

  • Hi,

     

    You need to store a large list of the quotes you want to display. Would be easier to do this in a file, one per line. Then you can use the System.IO.File.ReadAllLines() method which will read the file and create an array containing your files content, so one element in the array contains a quote. Next you want to use System.Random (I think) class to select a random number between 0 and the size of the array (the upperbounds), then you use that number to index a quote in the array and displays, hey bingo a random quote.

    Thursday, March 20, 2008 9:19 AM