www.webdeveloper.com
Results 1 to 2 of 2

Thread: Calling one VB.NET script from another

  1. #1
    Join Date
    May 2003
    Posts
    599

    Question Calling one VB.NET script from another

    I'm a newbie to VB.NET, and I need to know how to call code from an external VB.NET file from within method body. I was thinking something like this:

    CODE:
    Code:
    <script runat="server">
        Sub Page_Load(sender As Object, e As EventArgs)
            'Code for this page
            '...some code...
    
            'Code from external VB.NET doc goes here - HOW???
        End Sub
    </script>
    EXTERNAL VB.NET DOC'S CODE:
    Code:
    Sub hello
        headtitle.text = "HELLO WORLD!"
    End Sub
    
    If Not Page.IsPostBack Then
        '...some code...
    End If
    RESULTING CODE:
    Code:
    <script runat="server">
        Sub Page_Load(sender As Object, e As EventArgs)
            'Code for this page
            '...some code...
    
            'Code from external VB.NET doc
            Sub hello
                headtitle.text = "HELLO WORLD!"
            End Sub
    
            If Not Page.IsPostBack Then
                '...some code...
            End If
    
        End Sub
    </script>
    If anyone can show me how to do this, that would be great. Thanks.

  2. #2
    Join Date
    May 2003
    Posts
    599

    resolved

    Ok, I figured out how to do it as soon as I added my last post.

    This is the solution that worked for me:

    Code:
    <script runat="server">
        Sub Page_Load(sender As Object, e As EventArgs)
    </script>
    <script runat="server">
        'Page code goes here
    </script>
    <script language="vb" runat="server" src="external.vb" />
    <script runat="server">
        End Sub
    </script>
    And it worked! The change only resulted in the filesize being 142 bytes greater in size, but I'm not sure if doing it this way will cause any problems. If anyone knows whether or not it will cause problems, please let me know. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles