c#中出现名为“应为get或set访问器”的错误是什么意思?

shuchong0707 2008-07-23 08:07:50
我想问一下c#中出现名为“应为get或set访问器”的错误是什么意思?
程序如下
using System;
using System.Collections;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class SpuareInt : System.Windows.Forms.Form
{
private System.Windows.Forms.Button calculateButton;
private System.Windows.Forms.Label outputLabel;
[STAThread]
static void Main
{
Application.Run(new SquareTnt());
}
int Square(int y)
{
return y*y;
}
private void calculateButton_Click(object sender,System.EventArgs e)
{
outputLabel.Text="";
for(int counter=1;counter<=10;counter++)
{
int result=Square(counter);
outputLabel.Text+="The Square of" + counter + "is" +result +"\n";
}

}
}
注释就是在Application那个地方点明的错误,谢谢,急用
...全文
2502 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
austo 2011-07-25
  • 打赏
  • 举报
回复 2
哈哈,刚才有人让我帮他检查程序,也是这个问题,一直没发现代码有什么问题,后来一看也是方法没加括号!!!
Panda_Wang_ 2011-04-29
  • 打赏
  • 举报
回复 3
static void main ()少了小括号,,,我是在写 page_load(){}发现这问题的。。。。。。。。。。
nkhuangyanping 2010-11-10
  • 打赏
  • 举报
回复
哈哈,我也出现了这样的问题,后来好好看,也是自己粗心,忘记括号啦。哎。
lix1102 2010-02-05
  • 打赏
  • 举报
回复
我是在这里面的第一句报错的 怎么回事呢
SqlCommand cmd =new SqlCommand(Common.Class1.sql_getUser,cn);
da = new SqlDataAdapter(cmd);
da.Fill(ds, Common.Class1.table_User);
williamsong997 2009-12-08
  • 打赏
  • 举报
回复
我就刚犯了这个错误呢!谢谢指导!
cbl1218 2008-10-06
  • 打赏
  • 举报
回复
我也遇到这样的问题,粗心当然该打
shuchong0707 2008-07-23
  • 打赏
  • 举报
回复
我是阳历7月7日的,呵呵,你也是吗
shuchong0707 2008-07-23
  • 打赏
  • 举报
回复
谢谢了,确实是我自己太粗心了,忘记了括号
happyboxman 2008-07-23
  • 打赏
  • 举报
回复
这是方法
呢这样写。。还以为是属性了。。那当然要用get/set了
happyboxman 2008-07-23
  • 打赏
  • 举报
回复
static void Main
应为 static void Main ()
xs8577 2008-07-23
  • 打赏
  • 举报
回复
哦哦哦,楼主也是七月七日的哦?
xs8577 2008-07-23
  • 打赏
  • 举报
回复
SpuareInt SquareTnt ?

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧