我在 ac# 班,我必须编写这段代码,但我不太了解 c#,我的代码有这个问题。我的代码中有 6 个错误,它们都是相同的错误,说
“当前上下文中不存在名称“textbox1MESSAGE””
如果有人可以帮助我,那就太好了。如果有人帮助我老师不教课,也许我也可以学到一些东西。他们递给我一本书,说阅读并理解它,完成课堂作业并参加考试。你会通过这门课。我从来没有任何计算机语言的经验。
这是我的代码。它有什么问题?我做错了什么?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void Do_Click(object sender, EventArgs e)
{
int lcv = 1;
string szmessage = "";
szmessage += "the Do Loop - ";
do
{
szmessage += lcv.ToString();
textBox1MESSAGE.Text = szmessage;
textBox1MESSAGE.Refresh();
for (decimal i = 0m; i < 1000000m; i++) ;
lcv++;
}
while (lcv < 11);
}
private void While_Click(object sender, EventArgs e)
{
int lcv = 10;
string szmessage = "";
szmessage += "The While Loop - ";
while (lcv > 0)
{
szmessage += lcv.ToString();
textBox1MESSAGE.Text = szmessage;
textBox1MESSAGE.Refresh();
for (decimal i = 0m; i < 1000000; i++) ;
lcv--;
}
}
private void FOR_Click(object sender, EventArgs e)
{
int lcv = 1;
string szMessage = "";
szMessage += "The For Loop - ";
for (lcv = 1; lcv < 20; lcv += 2)
{
szMessage += lcv.ToString();
textBox1MESSAGE.Text = szMessage;
textBox1MESSAGE.Refresh();
for (Decimal i = 0m; i < 1000000m; i++) ;
}
}
}
}