SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Russia
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to call a Function in ASP.NET

    I have the following 1.aspx page

    Code:
    <%@ Page Language="VB" %>
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    </HEAD>
    <BODY>
    <%=stl%>
    </BODY>
    </HTML>
    <%
    public function stl() As String
    	return "Hello Word"
    end function
    %>
    When I run this page, I get the following error:
    Code:
    Compiler Error Message: BC30289: This statement cannot appear within a method body. The compiler will assume an intent to terminate the method body.
    
    Source Error:
    
     
    
    Line 9:  </HTML>
    Line 10: <%
    Line 11: public function stl() As String
    Line 12: 	return "Hello Word"
    Line 13: end function
    
    Source File: C:\WebServers\Gazeta\1.aspx    Line: 11
    Where am I wrong?
    Thank you
    Regards,
    Alexander Saprykin
    http://www16.brinkster.com/saprykin

  2. #2
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    Code:
    <%@ Page Language="VB" %>
    <script language="VB" runat="server">
    Sub Page_Load(Sender As Object, E As EventArgs)
       printStr = "Hello world"
       showStr.text = printStr
    end sub
    </script>
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    </HEAD>
    <BODY>
    <asp:label id="showStr" runat=server/>
    </BODY>
    </HTML>

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Russia
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you, dhtmlgod !!!
    Regards,
    Alexander Saprykin
    http://www16.brinkster.com/saprykin

  4. #4
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •