【发布时间】:2014-03-30 02:19:49
【问题描述】:
我得到的错误:
error on line 18 (Applicaiton.Run(new MainForm());
winform c# Error 1 'MyGame.MainForm' does not contain a constructor that takes 0 arguments
如何解决?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace MyGame
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm()); here is where the error is
}
}
}
【问题讨论】:
-
阅读错误应该可以准确地告诉您需要做什么。您正在尝试使用带有 0 个参数的构造函数来创建对象。您没有接受 0 个参数的构造函数。您认为解决方案可能是什么?
标签: c# winforms visual-studio-2010