I need some help people!
I typed the code on p. 83 exactly as it is and I get the same error msg every time:
Compiler Error Message: BC30451: Name 'msg' is not declared
<%@ Page Language="
vb" %>
<script runat="server">
Sub Page_Load()
If Page.IsPostBack Then Dim msg As String
If list1.Items(0).Selected Then msg = msg & list1.Items(0).Text & "<br />";
If list1.Items(1).Selected Then msg = msg & list1.Items(1).Text & "<br />"
If list1.Items(2).Selected Then msg = msg & list1.Items(2).Text & "<br />"
If msg <> "" then
Message.Text = "You have selected: <bt />" & msg
Else
message.text = ""
End if
End if
End Sub
</script>
<html>
<head>
<title>List Box Example</title>
</head>
<body>
<asp:Label id="Message" runat="server"></asp:Label>
<br />
Which city do you wish to look at hotels for?<br />
<form runat="server">
<asp:listbox id="list1" runat="server" selectionmode="multiple">
<asp:listitem>Madrid</asp:listitem>
<asp:listitem>Oslo</asp:listitem>
<asp:listitem>Lisabon</asp:listitem>
</asp:listbox>
<br />
<input type="submit" value="Submit Query" />
</form>
</body>
</html>
Now, I have a vague idea what it means but I have no clue how to fix it. I checked my code, retyped it three times, and still the same error msg. When I click on the Design/Preview tab in ASP.NET Web Matrix everything looks normal and I can see the drop down box and everything else but when I try to open the file through the browser the compiler brings the compilation error. Any ideas?