error creating the .dll for component??

anand

Regular
Joined
Jan 29, 2003
Messages
76
Location
chicago
Hi friends i am getting an error while creating the .dll for a component in vb.net....
the error is
Inherits System.ComponentModel.icontainer is not defined...

my code is:

Visual Basic:
Imports System
Imports System.Data
Imports System.ComponentModel.Component
Public Class Component1
    Inherits System.ComponentModel.Component
    Public Function func() As String
        func = "func from component1"
    End Function
#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

End Class

pls give me a idea whats my mistake and let me know how to craete a .dll for component.....


Thank you
Satya
 
Last edited by a moderator:
Hi devil
I remove that line still i am getting the same error....pls tell me can i create a dll for component...whats the diff between class and component in .net.....why its giving an error while creating the dll for component...

i am creating the dll like this

c:\anand\appl1\appl1>vbc /t:library c:\anand\appl1\appl1\component1.vb


pls give me idea what to do...
Thank you
Anand
 
Inherits System.ComponentModel.Component
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\anand\appl1\appl1\Component1.vb(15) : error BC30002: Type 'System.ComponentMo
del.IContainer' is not defined.

Public Sub New(ByVal Container As System.ComponentModel.IContainer)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\anand\appl1\appl1\Component1.vb(33) : error BC30284: sub 'Dispose' cannot be
declared 'Overrides' because it does not override a sub in a base class.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
~~~~~~~
c:\anand\appl1\appl1\Component1.vb(43) : error BC30002: Type 'System.ComponentMo
del.IContainer' is not defined.

Private components As System.ComponentModel.IContainer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\anand\appl1\appl1\Component1.vb(49) : error BC30002: Type 'System.ComponentMo
del.Container' is not defined.

components = New System.ComponentModel.Container()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\ANAND\APPL1\APPL1>
 
You need to tell the compiler that you're referencing the System.dll and System.Data.dll assemblies:

Code:
C:\>vbc /target:library component1.vb /reference:System.dll /reference:System.Data.dll
 
Hi divil
Lot of thanks .....its working fine now...it creates a .dll now for component.....
lot of thanks for ur time
Satya...
 
Hi Divil
I Have a small doubt now..
i created a .dll for a component and i created a strong name for that(comp1.snk) and i add that .snk file to my application ..and i write the line <assembly:assemblykeyfile("comp1.snk")>
i biuld my application..it didnt give any error..............


but when i am trying to add that .dll into global assembly cache its giving the error

C:\ANAND\DLLS>gacutil /i comp1.dll

Microsoft (R) .NET Global Assembly Cache Utility. Version 1.0.3705.0
Copyright (C) Microsoft Corporation 1998-2001. All rights reserved.

Failure adding assembly to the cache: Attempt to install an assembly without a strong name


pls give me a idea how to add my dll to GAC...
Thank you
satya
 
To give your assembly a strong name, you need to use the /keyfile:mykeyfile.sn parameter. This is all in the Framework SDK documentation.
 
hi divil
already i ceated a strong name to my assembly...i want to register that in global assembly cache...pls give me a idea how to do that...
Thank you
Satya
 
Back
Top