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

Threaded View

  1. #1
    Join Date
    Nov 2008
    Posts
    3

    Any idea how to randomize this?

    My Goal is for this data to be randomized every time it is read into the array from a file. Any suggestions?


    Code:
            public void Random_Load(object sender, EventArgs e)
            {
                System.IO.StreamReader wordsIn;
          string theWord;
          wordCount = 0;
           wordArray = new Word[100];
          try
          {
            wordsIn = new System.IO.StreamReader("wordData.txt");
            theWord = wordsIn.ReadLine();
            while (theWord != "EOF")
            {
              
              
              wordArray[wordCount++] = new Word(theWord);
              theWord = wordsIn.ReadLine();
              
            }
            wordsIn.Close();
          }
          catch (Exception ex)
          {
            MessageBox.Show("Error processing input file\n" + ex.Message);
          }
    Last edited by NCLSEA123; November 14th, 2008 at 12:12 AM.

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