using System;
using System.Windows.Forms;namespace _05_08
{
public class Form_05_08 : Form
{
public Form_05_08()
{
this.Click += new EventHandler(this.Form_Click);
}
public void Form_Click(object sender, EventArgs e)
{
MessageBox.Show("You clicked!");
} }
public class Class_05_08
{
public static void Main(String[] args)
{
Application.Run(new Form_05_08());
}
}
}错误 1 “WindowsApp1.Form1.Dispose(bool)”: 没有找到适合的方法来重写 D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.Designer.cs 14 33 WindowsApplication2
错误 2 程序“D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\obj\Debug\WindowsApplication2.exe”定义了不止一个入口点:“WindowsApplication2.Program.Main()” D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Program.cs 13 21 WindowsApplication2
错误 3 程序“D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\obj\Debug\WindowsApplication2.exe”定义了不止一个入口点:“_05_08.Class_05_08.Main(string[])” D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.cs 20 28 WindowsApplication2
怎么回事情啊 我点下面的报错 就在Main下有条红线
using System.Windows.Forms;namespace _05_08
{
public class Form_05_08 : Form
{
public Form_05_08()
{
this.Click += new EventHandler(this.Form_Click);
}
public void Form_Click(object sender, EventArgs e)
{
MessageBox.Show("You clicked!");
} }
public class Class_05_08
{
public static void Main(String[] args)
{
Application.Run(new Form_05_08());
}
}
}错误 1 “WindowsApp1.Form1.Dispose(bool)”: 没有找到适合的方法来重写 D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.Designer.cs 14 33 WindowsApplication2
错误 2 程序“D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\obj\Debug\WindowsApplication2.exe”定义了不止一个入口点:“WindowsApplication2.Program.Main()” D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Program.cs 13 21 WindowsApplication2
错误 3 程序“D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\obj\Debug\WindowsApplication2.exe”定义了不止一个入口点:“_05_08.Class_05_08.Main(string[])” D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.cs 20 28 WindowsApplication2
怎么回事情啊 我点下面的报错 就在Main下有条红线
解决方案 »
- ArrayList列表
- 一个关于地图的问题,帮我解决下,急急!!!
- 请教递归调用如何抛出异常
- 格式显示字符串问题.
- 帮忙看看更新数据库的简单问题!
- 关于vs.net 2005(.net2.0)做的项目中引用了vs.net 2003生成的类库(.net1.1)
- 动态执行方法
- 请教各位同仁!谢谢!
- System.IO.FileNotFoundException: 未能加载文件或程序集“office, Version=14.0.0.0, Culture=ne
- 新人求助C#CHM帮助文档
- vs2005(c#)中开发B/S应用程序为什么没有timer控件?
- 无法在Web服务器上启动调试."System.Net.DigestClient"的类型初始值设定项引发异常.
里也包括个Main ,去掉一个
那我还想请问怎么删除呢 是删除哪一个呢
是删除代码段 还是单词Main??
可以具体点么?
{
public static void Main(String[] args)
{
Application.Run(new Form_05_08());
}
}
改名或者去掉 出现新错误
错误 1 “_05_08.Form1”并不包含“AutoScaleMode”的定义 D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.Designer.cs 24 18 WindowsApplication2
错误 2 “_05_08.Form1”并不包含“Text”的定义 D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.Designer.cs 25 18 WindowsApplication2
错误 3 找不到类型或命名空间名称“Form1”(是否缺少 using 指令或程序集引用?) D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Program.cs 17 33 WindowsApplication2
错误 4 与“System.Windows.Forms.Application.Run(System.Windows.Forms.Form)”最匹配的重载方法具有一些无效参数 D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Program.cs 17 13 WindowsApplication2
错误 5 参数“1”: 无法从“Form1”转换为“System.Windows.Forms.Form” D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Program.cs 17 29 WindowsApplication2
和[STAThread]沒有關系。
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace _05_08
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Click(object sender, EventArgs e)
{
MessageBox.Show("You clicked!");// this.Click += new System.EventHandler(this.Form1_Click);位于Form1.Designer.cs 中
}
}
}Form1.Designer.csnamespace _05_08
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗体设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.Click += new System.EventHandler(this.Form1_Click);
this.ResumeLayout(false); } #endregion
}
}Program.csusing System;
using System.Collections.Generic;
using System.Windows.Forms;namespace _05_08
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
program.cs里面是有一个
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
错误 1 当前上下文中不存在名称“InitializeComponent” D:\Program Files\MyC\WindowsApplication2\WindowsApplication2\Form1.cs 15 13 WindowsApplication2
是必须的,窗体程序中Program.cs是主文件,Form1.Designer.cs
是由IDE用来布置可视化处理
如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace _05_08
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Click(object sender, EventArgs e)
{
MessageBox.Show("You clicked!");// this.Click += new System.EventHandler(this.Form1_Click);位于Form1.Designer.cs 中
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}