我从ReSharper收到一条关于从我的对象构造函数调用虚拟成员的警告.
为什么不做这件事?
在Visual Studio 2010 64位中,我无法设计我的表单.
我一直收到这个警告(和错误):
Warning 18
The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file:
MainForm --- The base class 'Blah' could not be loaded. Ensure the assembly has been referenced and that all projects have been built.
Run Code Online (Sandbox Code Playgroud)
这只发生在我为x64编译时......在x86中,设计师运行良好.
只是想明确我需要项目在x64上工作,因为很多项目的组件都是用x64编译的,如果表单是在x86中则无法工作.
有没有其他人遇到这个并找到了解决方案?
我使用Visual Studio 2008在winforms C#中实现了一个大表单.在对话的大部分工作正常后,当我尝试打开设计器时,它开始显示很多错误masseges.
"该变量要么未声明,要么从未分配过"
我得到了很多以前运行良好的控件.我认为它发生在我使用的自定义控件上
我有这样的代码:
这是基类:
public class BaseClass : UserControl
{
protected ListView list;
protected TreeView tree;
public BaseClass()
{
//...
}
//...
}
Run Code Online (Sandbox Code Playgroud)
儿童班
public partial class MyClass : BaseClass
{
public MyClass()
{
InitializeComponent();
this.BackColor = VisualStyleInformation.TextControlBorder;
this.Padding = new Padding(1);
}
//...
}
partial class MyClass
{
//...
private void InitializeComponent()
{
this.tree = new System.Windows.Forms.TreeView();
this.list = new System.Windows.Forms.ListView();
//...
this.tree.Location = new System.Drawing.Point(0, 23);
this.tree.Name = "blablabla";
}
}
Run Code Online (Sandbox Code Playgroud)
并警告:
Warning 1 The variable 'tree' is either undeclared …Run Code Online (Sandbox Code Playgroud) 我使用Windows窗体应用程序的C#创建了一个用户控件。此用户控件具有一些属性。在运行时,如果用户未输入此属性的值,我想显示一个消息框并退出应用程序。
问题是当我在用户控件的Load事件中编写检查代码时。当我将其拖放到窗体上时,将出现消息框。
private void UserControl1_Load(Object sender, EventArgs e)
{
if (_getFirstPageArgument==null || _getFirstPageArgument.Length==0)
{
throw new Exception("Some Message");
}
}
Run Code Online (Sandbox Code Playgroud)
如何区分表单上的负载和运行时上的负载?