**急,求救,在线等!<未将对象引用设置到对象的实例>

一个数据库有a1,a2两个字段。
在使用SelectionList控件时,显示a1字段。当用户选择之后,
想通过一个按钮,把a2字段的对应值显示在下一个窗体中。
现在我用SelectionList1.Selection.Value;
当我设定Label1.text=SelectionList1.Selection.Value;时,调试出现<未将对象引用设置到对象的实例>的错误。
请高手指点,求救!
private void Command1_Click(object sender, System.EventArgs e)
{
Label1.Text=SelectionList1.Selection.Value; //此行报错。
this.ActiveForm=Form2;
}
[408 byte] By [changton] at [2008-2-13]
# 1
先判断SelectionList1.Selection是否为空在取值
Sangel at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 2
我遇到过这样的问题,
首先就是看看SelectionList控件是否已经绑定数据,
还有就是Label1是否已经在页面申明了
protected System.Web.UI.WebControls.Label Label1;

test!
# 3
SelectionList是什么呀?我第一次听说也。
navicy-Gogo at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 4
private void Command1_Click(object sender, System.EventArgs e)
{
if (SelectionList1.Selection.Value!="") {
Label1.Text=SelectionList1.Selection.Value;
this.ActiveForm=Form2;
}
}

另外要看你的页面上有没有Label1控件?
navicy-Gogo at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 5
未将对象引用设置到对象的实例
--------------
SelectionList1没定义或SelectionList1不是实例化对象
caiyajun512-田鼠 at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 6
绑定的时候,有无分别指定TEXT和VALUE的对应字段?
# 7
加上这句吧
protected System.Web.UI.WebControls.Label Label1;
yyf_321-小子 at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 8
各位,以上的方法我都试了,可还是不行。
private void Command1_Click(object sender, System.EventArgs e)
{
if (SelectionList1.Selection.Value!="") //连这行都过不去。
{
Label1.Text=SelectionList1.Selection.Value;
this.ActiveForm=Form2;
}
}
changton at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...
# 9
SelectionList那个大虾开发的控件
hdt-倦怠 at 2007-11-1 > top of Msdn China Tech,.NET技术,ASP.NET...