Creating a custom class/Namespace

Discussion in 'ASP .Net' started by ryan.d.rembaum@kp.org, Aug 26, 2005.

  1. Guest

    Hello,

    I have code that I wish to use in many web applications. Basically
    sort of stand utility stuff. So from Visual Studio Project I select
    add a component and chose Component Class. Lets say I enter code at
    the end of this question in to the code section.

    How then would I reference this in a new Web Application (or in the
    same web application for that matter?)

    I have tried:
    <%@ Import Namespace="ByteArray.ByteArray" %>
    and
    <%@ Import Namespace="ByteArray" %>

    But when I run the page it just gives me a message that the Namespace
    can't be found.

    Thanks,
    Ryan

    ------------CODE FOLLOWS-----------------------------

    Imports System.Globalization
    Namespace ByteArray
    Public Class ByteArray
    Inherits System.ComponentModel.Component
    |Component Designer generated code...|

    Public Function CreateTypeByte(ByVal strInput As String) As
    Byte()
    Dim i As Integer
    Dim arrChar As Char()

    arrChar = strInput.ToCharArray()
    Dim arrByte(arrChar.Length - 1) As Byte
    For i = 0 To arrByte.Length - 1
    arrByte(i) = Convert.ToByte(arrChar(i))
    Next
    Return arrByte
    End Function

    Public Function CreateTypeHex(ByVal strInput As String) As
    Byte()
    Dim i As Integer
    Dim arrString As String()

    arrString = strInput.Split(New Char() {"-"})
    Dim arrByte(arrString.Length - 1) As Byte
    For i = 0 To arrByte.Length - 1
    arrByte(i) = Byte.Parse(arrString(i),
    NumberStyles.HexNumber)
    Next
    Return arrByte
    End Function
    End Class
    End Namespace
    , Aug 26, 2005
    #1
    1. Advertising

  2. Did you compile it ?



    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    <> wrote in message
    news:...
    > Hello,
    >
    > I have code that I wish to use in many web applications. Basically
    > sort of stand utility stuff. So from Visual Studio Project I select
    > add a component and chose Component Class. Lets say I enter code at
    > the end of this question in to the code section.
    >
    > How then would I reference this in a new Web Application (or in the
    > same web application for that matter?)
    >
    > I have tried:
    > <%@ Import Namespace="ByteArray.ByteArray" %>
    > and
    > <%@ Import Namespace="ByteArray" %>
    >
    > But when I run the page it just gives me a message that the Namespace
    > can't be found.
    >
    > Thanks,
    > Ryan
    >
    > ------------CODE FOLLOWS-----------------------------
    >
    > Imports System.Globalization
    > Namespace ByteArray
    > Public Class ByteArray
    > Inherits System.ComponentModel.Component
    > |Component Designer generated code...|
    >
    > Public Function CreateTypeByte(ByVal strInput As String) As
    > Byte()
    > Dim i As Integer
    > Dim arrChar As Char()
    >
    > arrChar = strInput.ToCharArray()
    > Dim arrByte(arrChar.Length - 1) As Byte
    > For i = 0 To arrByte.Length - 1
    > arrByte(i) = Convert.ToByte(arrChar(i))
    > Next
    > Return arrByte
    > End Function
    >
    > Public Function CreateTypeHex(ByVal strInput As String) As
    > Byte()
    > Dim i As Integer
    > Dim arrString As String()
    >
    > arrString = strInput.Split(New Char() {"-"})
    > Dim arrByte(arrString.Length - 1) As Byte
    > For i = 0 To arrByte.Length - 1
    > arrByte(i) = Byte.Parse(arrString(i),
    > NumberStyles.HexNumber)
    > Next
    > Return arrByte
    > End Function
    > End Class
    > End Namespace
    >
    Juan T. Llibre, Aug 26, 2005
    #2
    1. Advertising

  3. John Rivers Guest

    check this out, it may help:

    http://www.mcdonalds.com/


    wrote:
    > Hello,
    >
    > I have code that I wish to use in many web applications. Basically
    > sort of stand utility stuff. So from Visual Studio Project I select
    > add a component and chose Component Class. Lets say I enter code at
    > the end of this question in to the code section.
    >
    > How then would I reference this in a new Web Application (or in the
    > same web application for that matter?)
    >
    > I have tried:
    > <%@ Import Namespace="ByteArray.ByteArray" %>
    > and
    > <%@ Import Namespace="ByteArray" %>
    >
    > But when I run the page it just gives me a message that the Namespace
    > can't be found.
    >
    > Thanks,
    > Ryan
    >
    > ------------CODE FOLLOWS-----------------------------
    >
    > Imports System.Globalization
    > Namespace ByteArray
    > Public Class ByteArray
    > Inherits System.ComponentModel.Component
    > |Component Designer generated code...|
    >
    > Public Function CreateTypeByte(ByVal strInput As String) As
    > Byte()
    > Dim i As Integer
    > Dim arrChar As Char()
    >
    > arrChar = strInput.ToCharArray()
    > Dim arrByte(arrChar.Length - 1) As Byte
    > For i = 0 To arrByte.Length - 1
    > arrByte(i) = Convert.ToByte(arrChar(i))
    > Next
    > Return arrByte
    > End Function
    >
    > Public Function CreateTypeHex(ByVal strInput As String) As
    > Byte()
    > Dim i As Integer
    > Dim arrString As String()
    >
    > arrString = strInput.Split(New Char() {"-"})
    > Dim arrByte(arrString.Length - 1) As Byte
    > For i = 0 To arrByte.Length - 1
    > arrByte(i) = Byte.Parse(arrString(i),
    > NumberStyles.HexNumber)
    > Next
    > Return arrByte
    > End Function
    > End Class
    > End Namespace
    John Rivers, Aug 26, 2005
    #3
  4. Guest

    I built and rebuilt the project and solution and get no skips and no
    errors. Just a report of success...But then when I test my ASP page in
    my browser, I get the message in the compiler output that my namespace
    could not be found.

    Any thoughts?

    Ryan

    Juan T. Llibre wrote:
    > Did you compile it ?
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I have code that I wish to use in many web applications. Basically
    > > sort of stand utility stuff. So from Visual Studio Project I select
    > > add a component and chose Component Class. Lets say I enter code at
    > > the end of this question in to the code section.
    > >
    > > How then would I reference this in a new Web Application (or in the
    > > same web application for that matter?)
    > >
    > > I have tried:
    > > <%@ Import Namespace="ByteArray.ByteArray" %>
    > > and
    > > <%@ Import Namespace="ByteArray" %>
    > >
    > > But when I run the page it just gives me a message that the Namespace
    > > can't be found.
    > >
    > > Thanks,
    > > Ryan
    > >
    > > ------------CODE FOLLOWS-----------------------------
    > >
    > > Imports System.Globalization
    > > Namespace ByteArray
    > > Public Class ByteArray
    > > Inherits System.ComponentModel.Component
    > > |Component Designer generated code...|
    > >
    > > Public Function CreateTypeByte(ByVal strInput As String) As
    > > Byte()
    > > Dim i As Integer
    > > Dim arrChar As Char()
    > >
    > > arrChar = strInput.ToCharArray()
    > > Dim arrByte(arrChar.Length - 1) As Byte
    > > For i = 0 To arrByte.Length - 1
    > > arrByte(i) = Convert.ToByte(arrChar(i))
    > > Next
    > > Return arrByte
    > > End Function
    > >
    > > Public Function CreateTypeHex(ByVal strInput As String) As
    > > Byte()
    > > Dim i As Integer
    > > Dim arrString As String()
    > >
    > > arrString = strInput.Split(New Char() {"-"})
    > > Dim arrByte(arrString.Length - 1) As Byte
    > > For i = 0 To arrByte.Length - 1
    > > arrByte(i) = Byte.Parse(arrString(i),
    > > NumberStyles.HexNumber)
    > > Next
    > > Return arrByte
    > > End Function
    > > End Class
    > > End Namespace
    > >
    , Aug 27, 2005
    #4
  5. re:
    > > How then would I reference this in a new Web Application
    > > (or in the same web application for that matter?)


    To reference that code in a new web Application, you'd have
    to compile the code from the command-line, and reference
    *that* assembly in your VS.NET project.

    To compile a single source code file, use :

    csc /t:library /out:utils.dll utils.cs

    To compile all .cs files in a directory to utils.dll ,
    use : csc /t:library /out:utils.dll *.cs

    If you need to reference a .Net Framework assembly or assemblies,
    add them, separated by slashes :

    csc /t:library /r:system.dll /r:system.data.dll /out:utils.dll *.cs

    If you're using VB.NET instead of C#,
    use vbc and source files ending in .vb
    instead of using csc and source files ending in .cs.

    The syntax is the same for vb and c#.

    Once you have compiled your assembly, place it in the /bin
    directory of your application, and import the Namespace :

    <%@ Import Namespace="ByteArray" %>

    If you're working strictly with VS.NET, compile your assembly
    as described and add a reference to it in your VS.NET project.

    That will allow you to use Intellisense and get your
    assembly's properties, methods, etc. when coding.




    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    <> wrote in message
    news:...
    I built and rebuilt the project and solution and get no skips and no
    errors. Just a report of success...But then when I test my ASP page in
    my browser, I get the message in the compiler output that my namespace
    could not be found.

    Any thoughts?

    Ryan

    Juan T. Llibre wrote:
    > Did you compile it ?
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I have code that I wish to use in many web applications. Basically
    > > sort of stand utility stuff. So from Visual Studio Project I select
    > > add a component and chose Component Class. Lets say I enter code at
    > > the end of this question in to the code section.
    > >
    > > How then would I reference this in a new Web Application (or in the
    > > same web application for that matter?)
    > >
    > > I have tried:
    > > <%@ Import Namespace="ByteArray.ByteArray" %>
    > > and
    > > <%@ Import Namespace="ByteArray" %>
    > >
    > > But when I run the page it just gives me a message that the Namespace
    > > can't be found.
    > >
    > > Thanks,
    > > Ryan
    > >
    > > ------------CODE FOLLOWS-----------------------------
    > >
    > > Imports System.Globalization
    > > Namespace ByteArray
    > > Public Class ByteArray
    > > Inherits System.ComponentModel.Component
    > > |Component Designer generated code...|
    > >
    > > Public Function CreateTypeByte(ByVal strInput As String) As
    > > Byte()
    > > Dim i As Integer
    > > Dim arrChar As Char()
    > >
    > > arrChar = strInput.ToCharArray()
    > > Dim arrByte(arrChar.Length - 1) As Byte
    > > For i = 0 To arrByte.Length - 1
    > > arrByte(i) = Convert.ToByte(arrChar(i))
    > > Next
    > > Return arrByte
    > > End Function
    > >
    > > Public Function CreateTypeHex(ByVal strInput As String) As
    > > Byte()
    > > Dim i As Integer
    > > Dim arrString As String()
    > >
    > > arrString = strInput.Split(New Char() {"-"})
    > > Dim arrByte(arrString.Length - 1) As Byte
    > > For i = 0 To arrByte.Length - 1
    > > arrByte(i) = Byte.Parse(arrString(i),
    > > NumberStyles.HexNumber)
    > > Next
    > > Return arrByte
    > > End Function
    > > End Class
    > > End Namespace
    > >
    Juan T. Llibre, Aug 27, 2005
    #5
  6. Guest

    Hi Juan,

    Thanks for your help. I have tried what you suggested and am getting
    some errors. Here, first, are the contents of my .vb file:
    ---------------------------------------------
    Imports System.Globalization
    Namespace ByteArray
    Public Class ByteArray
    Inherits System.ComponentModel.Component
    #Region " Component Designer generated code "

    Public Sub New(ByVal Container As
    System.ComponentModel.IContainer)
    MyClass.New()

    'Required for Windows.Forms Class Composition Designer
    support
    Container.Add(Me)
    End Sub

    Public Sub New()
    MyBase.New()

    'This call is required by the Component Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent()
    call

    End Sub

    'Component overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As
    Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component
    Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()
    components = New System.ComponentModel.Container
    End Sub

    #End Region
    Public Function CreateTypeByte(ByVal strInput As String) As
    Byte()
    Dim i As Integer
    Dim arrChar As Char()

    arrChar = strInput.ToCharArray()
    Dim arrByte(arrChar.Length - 1) As Byte
    For i = 0 To arrByte.Length - 1
    arrByte(i) = Convert.ToByte(arrChar(i))
    Next
    Return arrByte
    End Function

    Public Function CreateTypeHex(ByVal strInput As String) As
    Byte()
    Dim i As Integer
    Dim arrString As String()

    arrString = strInput.Split(New Char() {"-"})
    Dim arrByte(arrString.Length - 1) As Byte
    For i = 0 To arrByte.Length - 1
    arrByte(i) = Byte.Parse(arrString(i),
    NumberStyles.HexNumber)
    Next
    Return arrByte
    End Function
    End Class
    End Namespace
    ---------------------------------------------

    I then compile it using:

    c:\WINNT\Microsoft.NET\Framework\v1.1.4322\csc.exe /target:library
    /out:ByteArray.dll /r:System.dll
    C:\Inetpub\wwwroot\testApp\ByteArray.vb

    I get a bunch of errors of four basic types:

    -Preprocessor directive expected.
    -Single Line Comment or End-of-Line expected.
    -Newline in constant.
    -A Namespace does not directly contain members such as fields or
    methods.

    Do you know why I am getting them. If I take out the system generated
    code, the errors decrease, but I thought that the system generated code
    was supposed to make my class more usuable. (Plus, I still get some of
    the errors even without the system generated code.)

    Thanks,
    Ryan

    Juan T. Llibre wrote:
    > re:
    > > > How then would I reference this in a new Web Application
    > > > (or in the same web application for that matter?)

    >
    > To reference that code in a new web Application, you'd have
    > to compile the code from the command-line, and reference
    > *that* assembly in your VS.NET project.
    >
    > To compile a single source code file, use :
    >
    > csc /t:library /out:utils.dll utils.cs
    >
    > To compile all .cs files in a directory to utils.dll ,
    > use : csc /t:library /out:utils.dll *.cs
    >
    > If you need to reference a .Net Framework assembly or assemblies,
    > add them, separated by slashes :
    >
    > csc /t:library /r:system.dll /r:system.data.dll /out:utils.dll *.cs
    >
    > If you're using VB.NET instead of C#,
    > use vbc and source files ending in .vb
    > instead of using csc and source files ending in .cs.
    >
    > The syntax is the same for vb and c#.
    >
    > Once you have compiled your assembly, place it in the /bin
    > directory of your application, and import the Namespace :
    >
    > <%@ Import Namespace="ByteArray" %>
    >
    > If you're working strictly with VS.NET, compile your assembly
    > as described and add a reference to it in your VS.NET project.
    >
    > That will allow you to use Intellisense and get your
    > assembly's properties, methods, etc. when coding.
    >
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > <> wrote in message
    > news:...
    > I built and rebuilt the project and solution and get no skips and no
    > errors. Just a report of success...But then when I test my ASP page in
    > my browser, I get the message in the compiler output that my namespace
    > could not be found.
    >
    > Any thoughts?
    >
    > Ryan
    >
    > Juan T. Llibre wrote:
    > > Did you compile it ?
    > >
    > >
    > >
    > > Juan T. Llibre
    > > ASP.NET MVP
    > > http://asp.net.do/foros/
    > > Foros de ASP.NET en Español
    > > Ven, y hablemos de ASP.NET...
    > > ======================
    > >
    > > <> wrote in message
    > > news:...
    > > > Hello,
    > > >
    > > > I have code that I wish to use in many web applications. Basically
    > > > sort of stand utility stuff. So from Visual Studio Project I select
    > > > add a component and chose Component Class. Lets say I enter code at
    > > > the end of this question in to the code section.
    > > >
    > > > How then would I reference this in a new Web Application (or in the
    > > > same web application for that matter?)
    > > >
    > > > I have tried:
    > > > <%@ Import Namespace="ByteArray.ByteArray" %>
    > > > and
    > > > <%@ Import Namespace="ByteArray" %>
    > > >
    > > > But when I run the page it just gives me a message that the Namespace
    > > > can't be found.
    > > >
    > > > Thanks,
    > > > Ryan
    > > >
    > > > ------------CODE FOLLOWS-----------------------------
    > > >
    > > > Imports System.Globalization
    > > > Namespace ByteArray
    > > > Public Class ByteArray
    > > > Inherits System.ComponentModel.Component
    > > > |Component Designer generated code...|
    > > >
    > > > Public Function CreateTypeByte(ByVal strInput As String) As
    > > > Byte()
    > > > Dim i As Integer
    > > > Dim arrChar As Char()
    > > >
    > > > arrChar = strInput.ToCharArray()
    > > > Dim arrByte(arrChar.Length - 1) As Byte
    > > > For i = 0 To arrByte.Length - 1
    > > > arrByte(i) = Convert.ToByte(arrChar(i))
    > > > Next
    > > > Return arrByte
    > > > End Function
    > > >
    > > > Public Function CreateTypeHex(ByVal strInput As String) As
    > > > Byte()
    > > > Dim i As Integer
    > > > Dim arrString As String()
    > > >
    > > > arrString = strInput.Split(New Char() {"-"})
    > > > Dim arrByte(arrString.Length - 1) As Byte
    > > > For i = 0 To arrByte.Length - 1
    > > > arrByte(i) = Byte.Parse(arrString(i),
    > > > NumberStyles.HexNumber)
    > > > Next
    > > > Return arrByte
    > > > End Function
    > > > End Class
    > > > End Namespace
    > > >
    , Aug 30, 2005
    #6
  7. It looks like you're trying to use a Windows Forms class in ASP.NET.

    > 'Required for Windows.Forms Class Composition Designer support





    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en Español
    Ven, y hablemos de ASP.NET...
    ======================

    <> wrote in message
    news:...
    Hi Juan,

    Thanks for your help. I have tried what you suggested and am getting
    some errors. Here, first, are the contents of my .vb file:
    ---------------------------------------------
    Imports System.Globalization
    Namespace ByteArray
    Public Class ByteArray
    Inherits System.ComponentModel.Component
    #Region " Component Designer generated code "

    Public Sub New(ByVal Container As
    System.ComponentModel.IContainer)
    MyClass.New()

    'Required for Windows.Forms Class Composition Designer
    support
    Container.Add(Me)
    End Sub

    Public Sub New()
    MyBase.New()

    'This call is required by the Component Designer.
    InitializeComponent()

    'Add any initialization after the InitializeComponent()
    call

    End Sub

    'Component overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As
    Boolean)
    If disposing Then
    If Not (components Is Nothing) Then
    components.Dispose()
    End If
    End If
    MyBase.Dispose(disposing)
    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component
    Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub
    InitializeComponent()
    components = New System.ComponentModel.Container
    End Sub

    #End Region
    Public Function CreateTypeByte(ByVal strInput As String) As
    Byte()
    Dim i As Integer
    Dim arrChar As Char()

    arrChar = strInput.ToCharArray()
    Dim arrByte(arrChar.Length - 1) As Byte
    For i = 0 To arrByte.Length - 1
    arrByte(i) = Convert.ToByte(arrChar(i))
    Next
    Return arrByte
    End Function

    Public Function CreateTypeHex(ByVal strInput As String) As
    Byte()
    Dim i As Integer
    Dim arrString As String()

    arrString = strInput.Split(New Char() {"-"})
    Dim arrByte(arrString.Length - 1) As Byte
    For i = 0 To arrByte.Length - 1
    arrByte(i) = Byte.Parse(arrString(i),
    NumberStyles.HexNumber)
    Next
    Return arrByte
    End Function
    End Class
    End Namespace
    ---------------------------------------------

    I then compile it using:

    c:\WINNT\Microsoft.NET\Framework\v1.1.4322\csc.exe /target:library
    /out:ByteArray.dll /r:System.dll
    C:\Inetpub\wwwroot\testApp\ByteArray.vb

    I get a bunch of errors of four basic types:

    -Preprocessor directive expected.
    -Single Line Comment or End-of-Line expected.
    -Newline in constant.
    -A Namespace does not directly contain members such as fields or
    methods.

    Do you know why I am getting them. If I take out the system generated
    code, the errors decrease, but I thought that the system generated code
    was supposed to make my class more usuable. (Plus, I still get some of
    the errors even without the system generated code.)

    Thanks,
    Ryan

    Juan T. Llibre wrote:
    > re:
    > > > How then would I reference this in a new Web Application
    > > > (or in the same web application for that matter?)

    >
    > To reference that code in a new web Application, you'd have
    > to compile the code from the command-line, and reference
    > *that* assembly in your VS.NET project.
    >
    > To compile a single source code file, use :
    >
    > csc /t:library /out:utils.dll utils.cs
    >
    > To compile all .cs files in a directory to utils.dll ,
    > use : csc /t:library /out:utils.dll *.cs
    >
    > If you need to reference a .Net Framework assembly or assemblies,
    > add them, separated by slashes :
    >
    > csc /t:library /r:system.dll /r:system.data.dll /out:utils.dll *.cs
    >
    > If you're using VB.NET instead of C#,
    > use vbc and source files ending in .vb
    > instead of using csc and source files ending in .cs.
    >
    > The syntax is the same for vb and c#.
    >
    > Once you have compiled your assembly, place it in the /bin
    > directory of your application, and import the Namespace :
    >
    > <%@ Import Namespace="ByteArray" %>
    >
    > If you're working strictly with VS.NET, compile your assembly
    > as described and add a reference to it in your VS.NET project.
    >
    > That will allow you to use Intellisense and get your
    > assembly's properties, methods, etc. when coding.
    >
    >
    >
    >
    > Juan T. Llibre
    > ASP.NET MVP
    > http://asp.net.do/foros/
    > Foros de ASP.NET en Español
    > Ven, y hablemos de ASP.NET...
    > ======================
    >
    > <> wrote in message
    > news:...
    > I built and rebuilt the project and solution and get no skips and no
    > errors. Just a report of success...But then when I test my ASP page in
    > my browser, I get the message in the compiler output that my namespace
    > could not be found.
    >
    > Any thoughts?
    >
    > Ryan
    >
    > Juan T. Llibre wrote:
    > > Did you compile it ?
    > >
    > >
    > >
    > > Juan T. Llibre
    > > ASP.NET MVP
    > > http://asp.net.do/foros/
    > > Foros de ASP.NET en Español
    > > Ven, y hablemos de ASP.NET...
    > > ======================
    > >
    > > <> wrote in message
    > > news:...
    > > > Hello,
    > > >
    > > > I have code that I wish to use in many web applications. Basically
    > > > sort of stand utility stuff. So from Visual Studio Project I select
    > > > add a component and chose Component Class. Lets say I enter code at
    > > > the end of this question in to the code section.
    > > >
    > > > How then would I reference this in a new Web Application (or in the
    > > > same web application for that matter?)
    > > >
    > > > I have tried:
    > > > <%@ Import Namespace="ByteArray.ByteArray" %>
    > > > and
    > > > <%@ Import Namespace="ByteArray" %>
    > > >
    > > > But when I run the page it just gives me a message that the Namespace
    > > > can't be found.
    > > >
    > > > Thanks,
    > > > Ryan
    > > >
    > > > ------------CODE FOLLOWS-----------------------------
    > > >
    > > > Imports System.Globalization
    > > > Namespace ByteArray
    > > > Public Class ByteArray
    > > > Inherits System.ComponentModel.Component
    > > > |Component Designer generated code...|
    > > >
    > > > Public Function CreateTypeByte(ByVal strInput As String) As
    > > > Byte()
    > > > Dim i As Integer
    > > > Dim arrChar As Char()
    > > >
    > > > arrChar = strInput.ToCharArray()
    > > > Dim arrByte(arrChar.Length - 1) As Byte
    > > > For i = 0 To arrByte.Length - 1
    > > > arrByte(i) = Convert.ToByte(arrChar(i))
    > > > Next
    > > > Return arrByte
    > > > End Function
    > > >
    > > > Public Function CreateTypeHex(ByVal strInput As String) As
    > > > Byte()
    > > > Dim i As Integer
    > > > Dim arrString As String()
    > > >
    > > > arrString = strInput.Split(New Char() {"-"})
    > > > Dim arrByte(arrString.Length - 1) As Byte
    > > > For i = 0 To arrByte.Length - 1
    > > > arrByte(i) = Byte.Parse(arrString(i),
    > > > NumberStyles.HexNumber)
    > > > Next
    > > > Return arrByte
    > > > End Function
    > > > End Class
    > > > End Namespace
    > > >
    Juan T. Llibre, Aug 30, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi Ambros Wallau
    Replies:
    0
    Views:
    4,087
    Ravi Ambros Wallau
    Jun 1, 2005
  2. E11
    Replies:
    1
    Views:
    4,745
    Thomas Weidenfeller
    Oct 12, 2005
  3. user
    Replies:
    1
    Views:
    435
    Kevin Spencer
    Jul 19, 2007
  4. Peng Yu
    Replies:
    0
    Views:
    641
    Peng Yu
    Sep 14, 2008
  5. c4tech
    Replies:
    0
    Views:
    371
    c4tech
    Jul 1, 2009
Loading...

Share This Page