[英]Type or Namespace Expected in C# 2.0 VS2005
Just wanna create an object of ProgressBar control as below code : 只需创建一个ProgressBar控件对象,如下代码:
pgImportProcess process = new pgImportProcess();
But it occurs an error 但它发生一个错误
Type or namespace name expected 预期的类型或名称空间名称
How to solve this problem ? 如何解决这个问题呢 ?
听起来好像您缺少包含pgImportProcess
类的名称空间的using
语句。
The winform progressbar class is located at System.Windows.Forms namespace so you need to write: winform progressbar类位于System.Windows.Forms命名空间,因此您需要编写:
System.Windows.Forms.ProgressBar process=new System.Windows.Forms.ProgressBar();
EDIT: 编辑:
@Oudam San: pgimportProcess is a name of ProgressBar Control , sorry for not detail explanation. @Oudam San:pgimportProcess是ProgressBar控件的名称,对不起详细解释。
That means reference variable pgimportProcess
is created (take a look at form designer code). 这意味着创建了引用变量
pgimportProcess
(请看表单设计器代码)。 However if you want to instantiate the ProgressBar
and want to store reference into pgimportProcess
variable then you may write: 但是,如果要实例化
ProgressBar
并将引用存储到pgimportProcess
变量中,则可以编写:
pgImportProcess = new ProgressBar();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.