Adblock breaks this site

Noob C# programmer needing help

Discussion in 'Programming General' started by ryanb415, Oct 14, 2012.

  1. ryanb415

    ryanb415 Member
    Banned

    Joined:
    Aug 9, 2012
    Posts:
    27
    Referrals:
    0
    Sythe Gold:
    1
    Noob C# programmer needing help

    I am currently working on a program that is Event based. (it's a form application)
    it is a number guessing game, I'm having no issue creating the random variable, however, Every time I click the button the number changes, I am wondering if there is a way to store the first number that the random number creates. Any help would be greatly appreciated
     
  2. iJava

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441
    Noob C# programmer needing help

    Just above the code that changes the number, store the variable if it's the first as an Integer, alternatively you could store them in an array.
     
  3. Blupig

    Blupig BEEF TOILET
    $5 USD Donor

    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant
    Noob C# programmer needing help

    int firstnumber;
    int isFirstClick = true;
    int randomnumber;

    private button click event blah blah(){

    if (isfirstclick == true)
    {
    isfirstclick = false;
    firstnumber = genRandom();
    return;
    }

    randomnumber = genRandom();

    }


    Something like that
     
< Listen .v2m module music in VB .NET | I will be taking computer programming in college (Look) >


 
 
Adblock breaks this site