T
tshad
I have the following class in my VS 2008 project that has a namespace of
MyFunctions.
*********************************
Imports System
Imports System.Text.RegularExpressions
Namespace MyFunctions
Public Class BitHandling
'*----------------------------------------------------------*
'* Name : BitSet *
'*----------------------------------------------------------*
'* Purpose : Sets a given Bit in Number *
'*----------------------------------------------------------*
Public Shared Function BitSet(ByVal 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
'*----------------------------------------------------------*
'* Name : BitClear *
'*----------------------------------------------------------*
'* Purpose : Clears a given Bit in Number *
'*----------------------------------------------------------*
Public Shared Function BitClear(ByVal Number As Integer, _
ByVal Bit As Integer) As Long
If Bit = 31 Then
Number = &H7FFFFFFF And Number
Else
Number = ((2 ^ Bit) Xor &HFFFFFFFF) And Number
End If
BitClear = Number
End Function
'*----------------------------------------------------------*
'* Name : BitIsSet *
'*----------------------------------------------------------*
'* Purpose : Test if bit 0 to bit 31 is set *
'*----------------------------------------------------------*
Public Shared Function BitIsSet(ByVal Number As Integer, _
ByVal Bit As Integer) As Boolean
BitIsSet = False
If Bit = 31 Then
If Number And &H80000000 Then BitIsSet = True
Else
If Number And (2 ^ Bit) Then BitIsSet = True
End If
End Function
End Class
Public Class Strings
'*----------------------------------------------------------*
'* Name : StripHtml *
'*----------------------------------------------------------*
'* Purpose :Strip HTML tags from Text *
'*----------------------------------------------------------*
Public Shared Function stripHTML(ByVal strHTML As String) As String
'Strips the HTML tags from strHTML
Dim strOutput As String
Dim objRegExp As New Regex("<(.|\n)+?>", RegexOptions.IgnoreCase)
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = strOutput.Replace("<", "<")
strOutput = strOutput.Replace(">", ">")
stripHTML = strOutput 'Return the value of strOutput
End Function
End Class
End Namespace
**********************************
In my default.aspx.vb I have:
Imports MyFunctions
But I am getting an error:
*************************************************
Namespace or type specified in the project-level Imports 'MyFunctions'
doesn't contain any public member or cannot be found. Make sure the
namespace or the type is defined and contains at least one public member.
Make sure the alias name doesn't contain other aliases.
*************************************************
But the above, namespace does exist and has public members (all of which
give me errors in my code saying that they are not declared?
I tried putting this file in the root as well as the under a folder called
"Classes" as I had it in my 2003 project and I also tried putting it in the
App_Code folder. None of which worked.
What am I missing?
Thanks,
Tom
MyFunctions.
*********************************
Imports System
Imports System.Text.RegularExpressions
Namespace MyFunctions
Public Class BitHandling
'*----------------------------------------------------------*
'* Name : BitSet *
'*----------------------------------------------------------*
'* Purpose : Sets a given Bit in Number *
'*----------------------------------------------------------*
Public Shared Function BitSet(ByVal 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
'*----------------------------------------------------------*
'* Name : BitClear *
'*----------------------------------------------------------*
'* Purpose : Clears a given Bit in Number *
'*----------------------------------------------------------*
Public Shared Function BitClear(ByVal Number As Integer, _
ByVal Bit As Integer) As Long
If Bit = 31 Then
Number = &H7FFFFFFF And Number
Else
Number = ((2 ^ Bit) Xor &HFFFFFFFF) And Number
End If
BitClear = Number
End Function
'*----------------------------------------------------------*
'* Name : BitIsSet *
'*----------------------------------------------------------*
'* Purpose : Test if bit 0 to bit 31 is set *
'*----------------------------------------------------------*
Public Shared Function BitIsSet(ByVal Number As Integer, _
ByVal Bit As Integer) As Boolean
BitIsSet = False
If Bit = 31 Then
If Number And &H80000000 Then BitIsSet = True
Else
If Number And (2 ^ Bit) Then BitIsSet = True
End If
End Function
End Class
Public Class Strings
'*----------------------------------------------------------*
'* Name : StripHtml *
'*----------------------------------------------------------*
'* Purpose :Strip HTML tags from Text *
'*----------------------------------------------------------*
Public Shared Function stripHTML(ByVal strHTML As String) As String
'Strips the HTML tags from strHTML
Dim strOutput As String
Dim objRegExp As New Regex("<(.|\n)+?>", RegexOptions.IgnoreCase)
'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")
'Replace all < and > with < and >
strOutput = strOutput.Replace("<", "<")
strOutput = strOutput.Replace(">", ">")
stripHTML = strOutput 'Return the value of strOutput
End Function
End Class
End Namespace
**********************************
In my default.aspx.vb I have:
Imports MyFunctions
But I am getting an error:
*************************************************
Namespace or type specified in the project-level Imports 'MyFunctions'
doesn't contain any public member or cannot be found. Make sure the
namespace or the type is defined and contains at least one public member.
Make sure the alias name doesn't contain other aliases.
*************************************************
But the above, namespace does exist and has public members (all of which
give me errors in my code saying that they are not declared?
I tried putting this file in the root as well as the under a folder called
"Classes" as I had it in my 2003 project and I also tried putting it in the
App_Code folder. None of which worked.
What am I missing?
Thanks,
Tom