當我輸入單詞「Andrea」時,程序崩潰。我猜測,但我認爲這是因爲我在循環內,它不知道何時停止。如果我是正確的,你能告訴我如何擺脫循環。當我休息時告訴我沒有循環結束。循環和while循環
private void button1_Click(object sender, EventArgs e)
{
do Commission.Text = (Convert.ToDouble(textBox2.Text)/10).ToString();
while (textBox1.Text == "Andrea");
break;
do Commission.Text = (Convert.ToDouble(textBox2.Text)/10).ToString();
while (textBox1.Text == "Brittany");
do Commission.Text = (Convert.ToDouble(textBox2.Text)/10).ToString();
while (textBox1.Text == "Eric");
break;
MessageBox.Show("The spelling of the name is incorrect", "Bad Spelling");
你的程序沒有什麼意義。你想做什麼?什麼是'textBox.Text'應該是? – NullUserException 2010-09-09 00:05:05
如果textbox1等於Andrea那麼我想執行計算。與布列塔尼和埃裏克同樣的事情。 – user770022 2010-09-09 00:09:55
我在代碼中沒有看到Eric的任何地方 – NullUserException 2010-09-09 00:10:56