Hi I'm trying to reset item1 to a new variable after I click the random newDayButton. At the moment it sets the text correctly but when I try to solve using the AnswerButton, the int is still set to 0?
`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;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
int item1 = 0;
int item2 = 10;
public Form1()
{
InitializeComponent();
Number1.Text = "" + item1;
Number2.Text = "" + item2;
}
private void newDayButton_Click(object sender, EventArgs e)
{
Random rnd = new Random();
int item1 = rnd.Next(1,10);
Number1.Text = "" + item1;
}
private void AnswerButton_Click(object sender, EventArgs e)
{
Sums test = new Sums();
int result = test.multiplynumbers(item1, item2);
answerText.Text = result.ToString();
}
}
}
`
It looks like you're new here. If you want to get involved, click one of these buttons!