Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2004, 10:15 AM
Authorized User
 
Join Date: Jul 2003
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beg ASP.NET 1.1 Chap 3 help

I have been over this for an hour and can't figure out why it does not work. Even though I get this error:
C:\begaspnet11\ch03\tio-variablescope1.aspx(7) : error BC30205: End of statement expected.

        Dim strMyBlockVariableUsedInside.Text = "Block VariableUsed In Block"
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\begaspnet11\ch03\tio-variablescope1.aspx(9) : error BC30451: Name 'strMyBlockVariableUsedInside' is not declared.

        lblMessageBlockInBlock.Text = strMyBlockVariableUsedInside
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\begaspnet11\ch03\tio-variablescope1.aspx(10) : error BC30451: Name 'strProcVariable' is not declared.

        lblMessageProcedure.Text = strProcVariable

Now this is my code and I don't see how it differs from the chapter 3 "tio-variablescope1.asp" It also tells me I didn't declare my variable and it appears I have.
Code:
<%@ Page Language="VB" %>
<script runat="server">

    Sub Page_Load()
        Dim strMyProcVariable = "Procedure Variable"
      If ISPostBack Then
        Dim strMyBlockVariableUsedInside.Text = "Block VariableUsed In Block"

        lblMessageBlockInBlock.Text = strMyBlockVariableUsedInside
        lblMessageProcedure.Text = strProcVariable
      End If

    End Sub
</script>
<html>
<head>
    <title>Variable Scope</title>
</head>
<body>
    <form runat="server">
        <asp:label id="lblMessageBlockInBlock" runat="server" text="DEFAULT_BlockInBlock">
        </asp:label>
        <br />
         <asp:label id="lblMessageProcedure" runat="server" text="DEFAULT_Procedure">
        </asp:label>

       <asp:Button runat="server" text="submit"/>

    </form>
</body>
</html>
I would appreciate help getting over this hump.
 
Old August 22nd, 2004, 10:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

You do not have any web control by name strMyBlockVariableUsedInside, so you cannot use this
Code:
Dim strMyBlockVariableUsedInside.Text = "Block VariableUsed In Block"
lblMessageBlockInBlock.Text = strMyBlockVariableUsedInside
How about this code?
Code:
If ISPostBack Then
        Dim strMyBlockVariableUsedInside = "Block VariableUsed In Block"

        lblMessageBlockInBlock.Text = strMyBlockVariableUsedInside
        lblMessageProcedure.Text = strProcVariable
      End If
      I just removed .Text from there. Try this.

And use <p></p> tag instead of <br />

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 22nd, 2004, 10:56 AM
Authorized User
 
Join Date: Jul 2003
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks! I get so involved in the process of moving from ASP to ASP.NET that you overlook something as basic as you can't use what you don't declare.

Thank you.
Rich

 
Old August 22nd, 2004, 11:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

No problem, it happens sometimes.;)

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beg Access 2K chap 8 ManFriday Access VBA 7 July 25th, 2007 05:18 AM
Problem with Exercise in Beg. asp.net for VB.net! mrfella71 BOOK: Beginning ASP.NET 1.0 1 October 23rd, 2005 12:06 PM
Chap 6 Beg ASP? re: loading .dll on server bhaub Classic ASP Basics 3 August 16th, 2004 11:31 PM
Chap 2 progs for Beg. Lin. Prog - 3rd Ed. walkerr Wrox Book Feedback 1 January 12th, 2004 10:37 AM
Beg Access 2002 VBA chap 6 Capitilzation cynwalker BOOK: Beginning Access VBA 1 December 26th, 2003 11:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.