I'm working on a project which generates a random number by taking a input from a textBox
then after the click of a button, it generates the number and puts it in a Label
.
I want to put the text like this:
public void Button_Click(object sender, RoutedEventArgs e)
{
string inputstr;
inputstr = textBox1.Text;
int inputnum;
inputnum = Convert.ToInt32(inputstr);
var me = new MainWindow();
Random rnd = new Random();
int outnum = rnd.Next(inputnum);
string outnum1 = outnum.ToString();
Label.Text = outnum1;
}
but it gives an error which is:
Severity Code Description Project File Line Suppression State Error CS0117 'Label' does not contain a definition for 'Text' RandomNumber C:\Users\Nameless\source\repos\RandomNumber\RandomNumber\MainWindow.xaml.cs 37 Active
I would be really thankful to anyone who helps.