Click to See Complete Forum and Search --> : Base Class


Nate1
April 4th, 2008, 06:43 PM
If I create a base class for my pages which will open my Database connection, load user data etc. Can I also define commonly used imports files in this class, when I do this currently it doesn't reference them

Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports database ' Class that would be used by child page

Public Class BasePage
Inherits System.Web.UI.Page

Private _Conn As SqlConnection

Public ReadOnly Property Conn() As SqlConnection
Get
If _Conn Is Nothing Then
_Conn = Utility.GetConnection
End If
Return _Conn
End Get
End Property


End Class

Shuja Ali
April 5th, 2008, 03:08 AM
Imports is usually only applicable to the module in which it is written.