Results 1 to 2 of 2

Thread: Cannot Create Random Text From Lists *Solved*

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2013
    Location
    Earth
    Posts
    230

    Cannot Create Random Text From Lists *Solved*

    Hello everyone and happy holidays!
    I have a question, how does one create random text using Random and Lists? In this example I have a list of vowels and a list of consonants, and depending on the length, it will keep adding random letters to the string, (CName). I am not recieving any new string in LabelName. I've done this example before, and it worked, so now I'm really confused! Help is greatly apprecieated, thanks!

    vb Code:
    1. Private Sub Rename()
    2.  
    3.         CName = ""
    4.         Dim Length As Int32 = NumericLength.Value
    5.         Randomize()
    6.         Do Until Length < 1
    7.             Length -= 1
    8.             Dim R1 As Random = New Random
    9.             Dim ChooseLetter1 As Int32 = Math.Round(R1.Next(0, Consonants.Count))
    10.             CName += Consonants(ChooseLetter1)
    11.             Dim R2 As Random = New Random
    12.             Dim ChooseLetter2 As Int32 = Math.Round(R2.Next(0, Vowels.Count))
    13.             CName += Vowels(ChooseLetter2)
    14.         Loop
    15.  
    16.         LabelName.Text = CName
    17.  
    18.     End Sub

    I found my error, I forgot to add in the "add characters to lists" block.
    Last edited by NinjaNic; Dec 20th, 2014 at 01:41 PM.

Tags for this Thread

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