Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote