Robie program w którym zgaduje się losową liczbę. Tylko właśnie nie mogę dać Randoma poza funkcję.
Chodzi o int koniec = losowa.Next(1, 12);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Reflection;
using System.Reflection.Emit;
using System.Security.Cryptography.X509Certificates;
namespace MineGame
{
public partial class Form1 : Form
{
Random losowa = new Random();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
int koniec = losowa.Next(1, 12);
private void btn1_Click(object sender, EventArgs e)
{
if (btn1.Text == koniec.ToString())
{
Application.Exit();
}
else
{
btn1.Enabled = false;
btn1.Text = "";
}
Nazwa.Text = koniec.ToString();
}