Shapper said:
Hi,
Could you please post the class code generated by Visual Studio or just
send it to me by email?
I am using Web Matrix. I consider it simpler to use.
I use DW, myself. I don't like VS2003,either. I am waiting for VS2005 -
which I hear is pretty good.
What I do is create a file (.vb), compile it and move it to my bin file.
Here is a simple one I use:
*******************************************************************
imports System
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
'*----------------------------------------------------------*
'* Name : BitClear *
'*----------------------------------------------------------*
'* Purpose : Clears a given Bit in Number *
'*----------------------------------------------------------*
Public Shared Function BitClear(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
End Namespace
*****************************************************************************
I then have a batch file - makeBitHandling.bat
****************************************
vbc /t:library bitHandling.vb /r:system.dll
copy bitHandling.dll bin\*.*
****************************************
In my .aspx page I do the following:
<%@ Import Namespace="MyFunctions" %>
I now can call these routines as:
dim id as integer
id = BitHandling.BitSet(id,4)
You can create many classes in different files and use the same namespace
and you they will all be handled as one. For example, I have another class
that handles my emails using the same namespace. It looks essentially like:
******************************************************************
Imports System
Imports System.Web
Imports System.IO
Imports System.Web.UI
Imports System.Web.SessionState
Imports System.Web.Mail
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.HttpCookie
Imports System.Web.HttpCookieCollection
Imports System.Web.HttpResponse
Imports System.Web.HttpRequest
imports System.Web.HttpContext
Imports System.Web.HttpApplication
Imports System.Web.HttpApplicationState
Imports Microsoft.VisualBasic
NameSpace MyFunctions
Public Class Email
Public Shared sub sendEmail ( body as string, emailType as string,
emailTitle as String)
...
end Class
end NameSpace
****************************************************************
I only have to use one import (<%@ Import Namespace="MyFunctions" %>) for
both classes.
Hope that helps,
Tom