Suppose I´m coding with notepad(no fancy VS.NET shortcuts). Now, in
directory foo I have 3 pages :pg1.aspx, pg1.apsx.vb (codebehind file),
class1.vb. How can I use class1 methods/values inside pg1.apsx.vb ?
Relevante code is below.
- pg1.aspx :
<%@src="pg1.aspx.vb" Inherits="pg1"%>
<html>
<asp:Label id="Label1" runat="server">l1</asp:Label>
</html>
- pg1.apsx.vb
Public Class pg1
Inherits System.Web.UI.Page
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim c As Class1
c = New Class1("1")
Label1.Text = c.strValue
End Sub
End Class
- class1.vb
Public Class Class1
Public strValue As integer
Public Sub New(ByVal Value As Integer)
strValue = Value * 2
End Sub
End Class