Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Assembly src="" in .vb files

Status
Not open for further replies.

ifx

Technical User
Feb 26, 2002
57
GB
Hi All,

Hopefully this is a quickie!

A few of the web apps we've built are not compiled, but instead use the directive similar to:
<%@ Assembly src="MyLib.vb" %>
in the top of the ASPX page, which relates to a .vb file in the directory with a couple of classes in it. (more code at the bottom) Very handy for anyone making small frequent changes, however I was wondering if anyone knows how you could link two .vb files together before they're using in the aspx page. Eg, we have default.aspx, MyLib.vb and DatabaseLib.vb. I can do
<%@ Assembly src="MyLib.vb" %>
<%@ Assembly src="DatabaseLib.vb" %>
in the top of default.aspx so I have the classes/functions of both available in default.aspx, but can I somehow make the functions from DatabaseLib.vb available in MyLib.vb by using a similar method?

I guess I could create a new instance of the class(es) in DatabaseLib.vb and pass them into the MyLib classes, but I was hoping there might be something as simple as
Imports "Databaselib.vb"
which I could put in the top of MyLib.vb.

Wow, I hope that makes sense! Bit of a long explanation, hopefully there's a shorter answer! Any help would be much appreciated.

Thanks,
Rob

Here's a snippet of what we have at the moment:

default.aspx:
Code:
<%@ Assembly src="MyLib.vb" %>
<%@ Assembly src="DatabaseLib.vb" %>
<script language="VB" runat="server">

Private NewLibrary As New MyLib
Private NewDBLibrary As New DBLib

Sub Page_Load(ByVal sender as Object,ByVal e As EventArgs)

... etc...

MyLib.vb:
Code:
Imports System
Imports System.Collections

Public Class MyLib

    Public LastError As String = ""

    Public Function MyFunction() As String
        '-- test ...

    End Function
End Class

DatabaseLib.vb:
Code:
Imports System
Imports System.Data
Imports System.Data.SQLClient

Public Class DBLib

    Public LastError As String = ""

    Public Function TestFunction() As String
        '-- test ...
    End Function
End Class
 
Are you in 2.0? check out the App_Code folder new in 2.0
 
Thanks for the suggestion adamroof. I'm in 1.1, but if I'm able to move over to 2.0 I'll be sure to check it out. Any suggestions with 1.1 still greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top