I am trying to get the text of a textbox and save it to a variable when the user presses the enter key (when the textbox has info and is focused) since this is already inside a method i haven't been able to put another method inside like txtbox1_keypress (or i've been doing it wrong) so I need to be just code lines that i can insert in this method
private void df1_Click(object sender, EventArgs e)
{
txtres.Focus();
//timer
timeLeft = 50;
timer1.Start();
//mult
do
{
ban = 0;
m1 = r.Next(1, 4);
txtm1.Text = m1.ToString();
m2 = r.Next(2, 6);
txtm2.Text = m2.ToString();
res = m1 * m2;
//here is where i want to read txtm2 and continue with the rest
if(txtres.Text == res.ToString())
{
pun++;
}
ban++;
} while (timeLeft > 0 || ban != 10);
if(pun == 10 && level == 0)
{
level++;
System.IO.File.WriteAllText(@".\level.lvl", level.ToString());
}
}