question from book =

use the next method from an object of type Random to produce 2 positive one digit integers. It should display a question in the status bar, such as: How much is 6 times 7?

The student should then type the answer into a textbox. Your program should check the students answer. If correct, draw the string "Very Good" in a read only textbox then ask another multiplication question. If the answer is wrong, draw the string "NO, please try again" in the same read only textbox, then let the student try the same question again untill the student finally gets it right. A separate method should be used to generate each new question. This method shoud be called once when the program begins execution and each time the user answers the question correctly.

the following code is what i have written so far(i have included the windows generated code so you can compile),
Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Ex6_14
{
	
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.StatusBar statusBar1;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textBox2;
		private System.ComponentModel.Container components = null;
		private Random ranObj1 = new Random(unchecked((int)DateTime.Now.Ticks));
		private Random ranObj2 = new Random();
		private int ranNum1, ranNum2, compAns, userAns;
		
		public Form1()
		{
			InitializeComponent();
			genQuestion();
		}

		
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.statusBar1 = new System.Windows.Forms.StatusBar();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// statusBar1
			// 
			this.statusBar1.Location = new System.Drawing.Point(0, 251);
			this.statusBar1.Name = "statusBar1";
			this.statusBar1.Size = new System.Drawing.Size(292, 22);
			this.statusBar1.TabIndex = 0;
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(24, 56);
			this.textBox1.Name = "textBox1";
			this.textBox1.TabIndex = 1;
			this.textBox1.Text = "";
			this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyDown);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(24, 32);
			this.label1.Name = "label1";
			this.label1.TabIndex = 2;
			this.label1.Text = "Enter Answer";
			// 
			// textBox2
			// 
			this.textBox2.Location = new System.Drawing.Point(24, 136);
			this.textBox2.Name = "textBox2";
			this.textBox2.ReadOnly = true;
			this.textBox2.Size = new System.Drawing.Size(176, 20);
			this.textBox2.TabIndex = 3;
			this.textBox2.Text = "";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Controls.Add(this.textBox2);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.statusBar1);
			this.Name = "Form1";
			this.Text = "Multiplication Test";
			this.ResumeLayout(false);

		}
		#endregion

		
		static void Main() 
		{
			Application.Run(new Form1());
		}

		public void genQuestion()
		{
			ranNum1 = ranObj1.Next(1, 10);
			ranNum2 = ranObj2.Next(1, 10);
			compAns = ranNum1 * ranNum2;
 			statusBar1.Text = "\tHow much is " + ranNum1 + " times " + ranNum2 + " ?";
			
		}

		
		private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			if( e.KeyCode == Keys.Enter )
			{
				userAns = Int32.Parse(textBox1.Text);
				if(userAns != compAns)
					textBox2.Text = "NO, please try again";
				else 
					textBox2.Text = "Well Done!";

				genQuestion();
			}
		}
	}
}
im stuck with the logic of how to loop around when the user gets the answer wrong. If i use a while loop where the if is
Code:
if(userAns != compAns)
					textBox2.Text = "NO, please try again";
				else 
					textBox2.Text = "Well Done!";
the program hangs

feedback would be greatly appreciated



luigi