在vs2005中新建了个web控件库,代码如下:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace Wrox
{
public class StaticListBox:WebPart
{
private String _labelStartText=" Enter State Name: ";
TextBox StateInput=new TextBox ();
ListBox StateContents=new ListBox(); public StaticListBox()
{
AllowClose=false;
} [Personalizable(),WebBrowsable]
public String LabelStartText
{
get{ return _LabelStartText;}
set{ _LabelStartText=value;}
} protected override void CreateChildControls()
{
Controls.Clear (); Label InstructionText=new Label();
InstructionText.BackColor =System.Drawing.Color.LightGray ;
InstructionText .Font .Name ="Verdana";
InstructionText .Font.Size =10;
InstructionText .Font.Bold =true;
InstructionText .Text =LabelStartText ;
Controls .Add (InstructionText ); Literal LineBreak=new Literal ();
LineBreak .Text ="<br/>";
Controls .Add (LineBreak ); Controls .Add (StateInput ); Button InputButton=new Button();
InputButton .Text ="Input State";
InputButton .Click+=this.Button_Click;
Controls .Add (InputButton); Literal Spacer=new Literal();
Spacer.Text ="<p>";
Controls .Add (Spacer ); Controls .Add (StateContents ); ChildControlsCreated=true;
} private void Button1_Click(obejct sender, EventArgs e)
{
StateContents.Items.Add (StateInput.Text );
StateInput .Text =string .Empty ;
StateInput .Focus (); }
}
} 代码没报错,编译时出错:错误 1 找不到类型或命名空间名称“obejct”(是否缺少 using 指令或程序集引用?) C:\Documents and Settings\ccokUser2\My Documents\Visual Studio 2005\Projects\MyStaticListBox\MyStaticListBox\MyStaticListBox.cs 63 39 MyStaticListBox 查看了一下引用了System,System.Drawing,System.Web这三个,是不是还要添加什么引用?
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
namespace Wrox
{
public class StaticListBox:WebPart
{
private String _labelStartText=" Enter State Name: ";
TextBox StateInput=new TextBox ();
ListBox StateContents=new ListBox(); public StaticListBox()
{
AllowClose=false;
} [Personalizable(),WebBrowsable]
public String LabelStartText
{
get{ return _LabelStartText;}
set{ _LabelStartText=value;}
} protected override void CreateChildControls()
{
Controls.Clear (); Label InstructionText=new Label();
InstructionText.BackColor =System.Drawing.Color.LightGray ;
InstructionText .Font .Name ="Verdana";
InstructionText .Font.Size =10;
InstructionText .Font.Bold =true;
InstructionText .Text =LabelStartText ;
Controls .Add (InstructionText ); Literal LineBreak=new Literal ();
LineBreak .Text ="<br/>";
Controls .Add (LineBreak ); Controls .Add (StateInput ); Button InputButton=new Button();
InputButton .Text ="Input State";
InputButton .Click+=this.Button_Click;
Controls .Add (InputButton); Literal Spacer=new Literal();
Spacer.Text ="<p>";
Controls .Add (Spacer ); Controls .Add (StateContents ); ChildControlsCreated=true;
} private void Button1_Click(obejct sender, EventArgs e)
{
StateContents.Items.Add (StateInput.Text );
StateInput .Text =string .Empty ;
StateInput .Focus (); }
}
} 代码没报错,编译时出错:错误 1 找不到类型或命名空间名称“obejct”(是否缺少 using 指令或程序集引用?) C:\Documents and Settings\ccokUser2\My Documents\Visual Studio 2005\Projects\MyStaticListBox\MyStaticListBox\MyStaticListBox.cs 63 39 MyStaticListBox 查看了一下引用了System,System.Drawing,System.Web这三个,是不是还要添加什么引用?
解决方案 »
- 下载函数this.Response.TransmitFile(downLoadPath);无法捕获异常
- 一个小调查
- [ASP.NET]AjaxPro.dll无法访问的问题
- VS2005点击新建网站出现的模板却是新建项目的模板,求助怎么回事??
- {********}100分{********},初来,散分,再问一问,信誉分,是怎么回事??
- 没有换行和空格!
- goody9807老大,再次求教 !!!!!
- 为什么我得不到行的值?
- ASP.NET用什么数据控件怎么样进行这样的数据绑定显示?
- 关于报表同时传递多个参数的问题.....
- js设置iframe的src,页面刷新
- 关于图表chart局部放大问题
应该是引用出错了
object 在这命名空间下
我给的代码第一行就有using System ..........