Modify the function below so that it generates a random number between 9 and 62
ID: 3558897 • Letter: M
Question
Modify the function below so that it generates a random number between 9 and 62
Private: System: :Void Form1_Load(System: :Object^ sender,
System: :Windows: :Forms: :KeyEventArgs^ e)
{
TextBox1 -> Focus(); // set Focus to textbox1
}
Bool keyHandled;
Private: System: :Void textBox1_KeyDown(System: :Object^ sender,
System: :Windows: :Forms: :KeyEventArgs^ e)
{ //this is called first
keyHadled = true;
if (e->KeyCode >= Keys: :NumPad0 && e->KeyCode <=Keys: :NumPads9 ||
e-> KeyCode >=Keys: :D0 && e->KeyCCode <=Keys: :D9 &&
e->Shift == false ||
e->KeyCode >= Keys: :A && e-> KeyCode <=Keys: :F ||
e-> KeyCode == Keys: :Back)
{
keyHandled=false;
}
}
Private: System: :Void textBox1_LeyPress(System: :Object^ sender,
System: :Windows: :Forms: :KeyPressEventArgs^ e)
{ // this is called second
If (e->KeyChar>=
Explanation / Answer
use
Random rnd = new Random();
int randNum = rnd.Next(9, 62);
put this inside the method or function wherever you need a response to keypress.(or keydown)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.