Page 157: This doesn't jive with the file T10-ForEach.aspx which is in the downloaded code. Running the file returns the error:
"BC32023: Expression is of type 'System.Web.UI.WebControls.ListBox', which is not a collection type."
The whole file is small:
[code]
<%@ Page Language="
vb" %>
<script runat="server">
Sub Page_Load()
If IsPostBack
Dim Cities as object
lblMessage.text = "we will send you information on these cities:"
For Each Cities in lstCities
lblMessage.text += Cities.Value & "<br/>"
Next
End If
End Sub
</script>
<html>
<head>
<title>For Next Example</title>
</head>
<body>
<form runat="server">
<asp:Label runat="server" ID="lblMessage"/>
Select all the cities that interest you: <br />
<asp:listbox id="lstCities" runat="server">
<asp:listitem>England</asp:listitem>
<asp:listitem>Holland</asp:listitem>
<asp:listitem>Norway</asp:listitem>
<asp:listitem>Portugal</asp:listitem>
<asp:listitem>Spain</asp:listitem>
</asp:listbox>
<br />
<input type="submit" value="Submit Query" />
</form>
</body>
</html>
[Code]
I've been playing with the file to get it to do something but can't figure it out. Is this one for the Errata form, or can someone help me with the file?
Thanks,
Steve