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:
MyLib.vb:
DatabaseLib.vb:
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