Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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 September 8th, 2006, 10:17 AM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

KWilliams
 
Old September 8th, 2006, 01:52 PM
Banned
 
Join Date: Jul 2005
Posts: 317
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.

KWilliams
 
Old September 11th, 2006, 06:26 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Why do you want to do this? It sound's like you are doing something similar to an old 'include file' from asp classic.

"The one language all programmers understand is profanity."





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling VB.Net Dll from Excel VBA zyphax Pro VB.NET 2002/2003 4 July 16th, 2007 08:41 PM
Calling Oracle function from Vb.net class monuindia2002 ADO.NET 1 August 4th, 2006 05:00 AM
Calling Stored procedure in VB.NET kganti VB.NET 2002/2003 Basics 0 March 26th, 2006 08:30 PM
Newbie: Calling a VB doc from ASP.NET kwilliams Classic ASP Basics 2 August 31st, 2005 09:10 AM
Calling a .Dll of Vb.NET enggalok C++ Programming 0 March 1st, 2004 06:51 PM





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