本文介绍了该变量或者是未声明或从未分配警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有code是这样的:
I have code like this:
这是基类:
public class BaseClass : UserControl
{
protected ListView list;
protected TreeView tree;
public BaseClass()
{
//...
}
//...
}
儿童类
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";
}
}
和警告:
Warning 1 The variable 'tree' is either undeclared or was never assigned.
Warning 2 The variable 'list' is either undeclared or was never assigned.
我是什么做错了吗?这个变量在基类中声明,并在子类中进行分配。
What am I doing wrong ? This variable are declared in base class, and assigned in child class.
推荐答案
这个问题缺少的的答案的,所以这里去...
This question lacks an answer, so here goes...
重建解决方案,然后重新启动Visual Studio 为我工作: - )
由于 SLaks 上面他的意见。
Thanks to SLaks for his comment above.
目前还讨论了:
stackoverflow.com - 变量变量名或者是未声明或从未分配
social.msdn.microsoft.com - 变量control_name'要么是未声明或从未分配
这篇关于该变量或者是未声明或从未分配警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!