C# problem with System.Windows.Forms console application

Stefanos Tsitmidelis 21 Reputation points
2021-04-07T05:58:58.487+00:00

using System;
using System.Windows.Forms;

class RandomInt
{
// main entry point for application
static void Main(string[] args)
{
int value;
string output = "";

    Random randomInteger = new Random();

    // loop times
    for (int i = 1; i <= 20; i++)
    {
        // pick random integer between 1 and 6
        value = randomInteger.Next(1, 7);
        output += value + " "; // append value to output

        // if counter divisible by 5, append newline
        if (i % 5 == 0)
            output += "\n";

    } // end for structure

    MessageBox.Show(output,
                     "Random Numbers from 1 to 6",
                     MessageBoxButtons.OK,
                     MessageBoxIcon.Information);

} // end Main

} // end class RandomInt

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,205 questions
{count} votes

Accepted answer
  1. Castorix31 81,461 Reputation points
    2021-04-07T06:06:10.163+00:00

    Right-Click on project,
    [Add]
    [Reference...]
    System.Windows.Forms


1 additional answer

Sort by: Most helpful
  1. Stefanos Tsitmidelis 21 Reputation points
    2021-04-07T15:30:04.407+00:00

    thank you Castorix31, again very much. It is worked

    0 comments No comments