Random Numbers in GUI (Windows Forms)
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Random Numbers in GUI (Windows Forms)

  1. #1
    Join Date
    Jan 2009
    Posts
    146

    Exclamation Random Numbers in GUI (Windows Forms)

    I want to generate 5 random numbers in an integer array of size 5 in GUI (Windows Forms), how will I do this? (MS Visual Studio 2008). Thanks!!

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,047

    Re: Random Numbers in GUI (Windows Forms)

    This isn't the right forum for forms.

    Generating random number is completely unrelated to any kind of GUI. What part are you stuck on?

  3. #3
    Join Date
    Jan 2009
    Posts
    146

    Re: Random Numbers in GUI (Windows Forms)

    Quote Originally Posted by GCDEF View Post
    This isn't the right forum for forms.

    Generating random number is completely unrelated to any kind of GUI. What part are you stuck on?
    Code:
    Random *r=new Random();
    
    int x=r->Next(0,2);
    This is how Im trying to fill the array with random numbers but the code above doesn't work in Visual Studio 2008 (It worked with the previous version somehow), this is what Im trying to do.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,047

    Re: Random Numbers in GUI (Windows Forms)

    You should take this to a .net forum.

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Random Numbers in GUI (Windows Forms)

    You mean:
    Code:
    Random^ r = gcnew Random();
    
    int x=r->Next(0,2);
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  6. #6
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Random Numbers in GUI (Windows Forms)

    [ redirected ]
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  7. #7
    Join Date
    Jan 2009
    Posts
    146

    Re: Random Numbers in GUI (Windows Forms)

    Quote Originally Posted by cilu View Post
    You mean:
    Code:
    Random^ r = gcnew Random();
    
    int x=r->Next(0,2);
    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center