By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,491 Members | 1,207 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,491 IT Pros & Developers. It's quick & easy.

How do you get .vb file to compile

P: n/a
I have the following class in my VS 2008 Web Site 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 &lt; and &gt;
strOutput = strOutput.Replace("<", "&lt;")
strOutput = strOutput.Replace(">", "&gt;")

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.
*************************************************

When I added "Imports", Intellisense didn't have MyFunctions in the list
even when the .vb file was in the root or App_Code folder.

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 then tried to manually compile the program using a makeBitHandling.bat
file, which also didn't seem to work as it did in VS 2003. This is the
actual file I used in my VS 2003 project:

vbc /t:library bitHandling.vb /r:system.dll
attrib ..\bin\bitHandling.dll -r
copy bitHandling.dll ..\bin\*.*

But it doesn't seem to read it correctly. I get the following error:

???vbc' is not recognized as an internal or external command,
operable program or batch file.

Where the ??? are actually strange characters.

Not sure what the prefix characters are but if I copy the lines and paste
them into the console, it works fine and puts the .dll file into the bin
folder that I created.

Now when I type in:

Imports MyFunctions

It recognizes it. When I type it "Imports ", Intellisense shows MyFunctions
in the list - so it does see it.

but all the functions: BitClear, BitSet and BitIsSet all show as undefined.
And you can see the class below where all the functions are private.

Why doesn't the program see them????

Can't I get the VS 2008 to compile the .vb files?

Do they have to be aspx.vb files?

Thanks,

Tom

Sep 13 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.