到底那里出错了?
<script language="VB" runat="server">
sub Page_Load(obj as Object, e as EventArgs)
if not Page.IsPostBack then
'create an array of colors
dim arrColors() as string = _
{"red", "orange", "yellow", "green", _
"blue", "indigo", "violet"}
lbColors.DataSource = arrColors
end if
DataBind()
end sub
</script>
<html><body>
<form runat="server">
<asp:Listbox runat="server" id="lbColors"
width="150"
AutoPostBack="true"
SelectionMode="Single" >
</asp:Listbox><p>
<asp:Label id="lblMessage" runat="server"
Text='<%# lbColors.SelectedItem.Text %>' />
</form>
</body></html>
*********************************************
错误信息
“/”应用程序中的服务器错误。
-----------------------------
未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。