Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 June 3rd, 2005, 02:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 100
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to ~Bean~
Default Namespace

 I have a class for data access I have put together as a ".vb" file in my project...basically it looks like...


Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Text.RegularExpressions
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Namespace dataIncludes

    Public Class includeFunctions

'all my functions here

    End Class

End Namespace



My problem is how to have my web forms get access to this class. (?)
Using:

Imports dataIncludes

doesnt seem to work...

-------------------------
Beware of programmers with screwdrivers...
__________________
-------------------------
Beware of programmers with screwdrivers...
 
Old June 3rd, 2005, 02:48 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You need to instantiate the class as an object:

Dim <objectName> As New <class file>

 
Old June 3rd, 2005, 04:30 PM
Registered User
 
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Or if a shared function, just call the method prepended with class name.

For example, I have a class set up such:

NameSpace MyFunctions

 Public Class BitHandling

  '*----------------------------------------------------------*
  '* Name : BitSet *
  '*----------------------------------------------------------*
  '* Purpose : Sets a given Bit in Number *
  '*----------------------------------------------------------*
  Public Shared Function BitSet(Number As Integer, _
              ByVal Bit As Integer) As Long
   If Bit = 31 Then
    Number = &H80000000 Or Number
   Else
    Number = (2 ^ Bit) Or Number
   End If
   BitSet = Number
  End Function
 end class
end Function

I can call this function like so:

  dim id as integer
  id = BitHandling.BitSet(id,4)

Tom






Similar Threads
Thread Thread Starter Forum Replies Last Post
Two namespace contain same name nir_pankaj C# 1 February 21st, 2007 12:30 PM
Namespace ~Bean~ Classic ASP Basics 2 June 3rd, 2005 02:31 PM
namespace Ibn_Aziz C# 2 December 25th, 2003 05:41 AM
namespace within namespace Bill Crawley XML 1 December 11th, 2003 10:59 AM
Namespace flute Pro VB.NET 2002/2003 2 October 21st, 2003 09:15 AM





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