saint1000's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
18 (0.02 per day)
Joined:
22-January 13
Profile Views:
1,765
Last Active:
User is offline Feb 17 2014 06:14 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   saint1000 has not set their status

Posts I've Made

  1. In Topic: random number generator that wont pull same number twice in a row

    Posted 17 Feb 2014

    View Postthecoat, on 16 February 2014 - 07:52 AM, said:

    When you instantiate an integer variable it initially has a value of zero.

    Dim number As Integer
    


    Dim number As Integer = 0
    


    Dim number As Integer
    number = 0
    


    All three of these pieces of code end up in the same result. So any time Label2.text does not equal 0 when you call the function it is being set to 0 because the random call inside the do loop is skipped.

    Change line 2 to this:

    Dim number As Integer = CInt(Label2.Text)
    


    thank you. very helpfull!
  2. In Topic: random number generator that wont pull same number twice in a row

    Posted 16 Feb 2014

    i realize getting the same number twice in a row is random. just for my use i can not have the same number twice in a row.

      Dim rndnumber As Random
            Dim number As Integer
            rndnumber = New Random
            Do Until number <> Label2.Text
                number = rndnumber.Next(1, 5)
               
            Loop
    
            Label2.Text = number.ToString
    

    here is my random number generator. the number generator works fine until i add the loop. with the loop added it will start returning zero as one of my random numbers which i dont understand. my random number need to be 1-4. with out the loop it never gives me a zero.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

saint1000 hasn't added any friends yet.

Comments

saint1000 has no profile comments yet. Why not say hello?