简体   繁体   中英

Type or Namespace Expected in C# 2.0 VS2005

Just wanna create an object of ProgressBar control as below code :

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:

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.

That means reference variable pgimportProcess is created (take a look at form designer code). However if you want to instantiate the ProgressBar and want to store reference into pgimportProcess variable then you may write:

pgImportProcess = new ProgressBar();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM