UserControl raises an event that is caught on a web page...
When however we make the UserControl implement an interface that itself
declares an event, we can put the event handling for that in the web page
(VS treats both events the same) BUT cannot run it... The error is:
Exception Details: System.TypeLoadException: Could not load type
evFinishedEventHandler from assembly ....
Can somebody help please? Is this a bug in Beta 2??
Cheers
Daniel
"JL.Seagull" <JL.se...@tiscalinet.com> wrote in message
news:uNfyy1WmBHA.2080@tkmsftngp04...
> Hello everybody,
> I'm quite puzzled by an error message I keep receiving on a simple test
> solution.
> I have two project on the solution:
> WindowsApplication1, containing a form (Form1) which instanciate a
> CustomerInfo object in this way:
>
> Private WithEvents cus As WindowsApplication1.CustomerInfo = New
> CustomerInfo()
> and a "WindowsApplication2", which contains the definition of the
> IcustomerInfo interface and the CustomerInfo class, that implements
> ICustomerInfo (I got this interface and class in the Inteface Statement
> topic of the online help)
>
> WindowsApplication1 references WindowsApplication2.
>
> Here is the code for Form 1 (WindowsApplication1, root namespace
> WindowsApplication1):
>
>
>
> Public Class Form1
>
> Inherits System.Windows.Forms.Form
>
> Private WithEvents cus As WindowsApplication1.CustomerInfo = New
> CustomerInfo()
>
> #Region " Windows Form Designer generated code "
>
> Public Sub New()
>
> MyBase.New()
>
> 'This call is required by the Windows Form Designer.
>
> InitializeComponent()
>
> 'Add any initialization after the InitializeComponent() call
>
> End Sub
>
> 'Form 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 Windows Form Designer
>
> Private components As System.ComponentModel.Container
>
> 'NOTE: The following procedure is required by the Windows Form Designer
>
> 'It can be modified using the Windows Form Designer.
>
> 'Do not modify it using the code editor.
>
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
>
> '
>
> 'Form1
>
> '
>
> Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
>
> Me.ClientSize = New System.Drawing.Size(560, 397)
>
> Me.Name = "Form1"
>
> Me.Text = "Form1"
>
> End Sub
>
> #End Region
>
>
>
>
> Private Sub cus_UpdateComplete() Handles cus.UpdateComplete
>
> End Sub
>
> End Class
>
>
> And here is the code for class UserInfo (WindowsApplication2, root
namespace
> WindowsApplication1) :
>
> Interface IcustomerInfo
>
> ' Declare an interface.
>
> Property CustomerName() As String
>
> Sub UpdateCustomerStatus()
>
> Event UpdateComplete()
>
> End Interface
>
> Public Class CustomerInfo
>
> ' The CustomerInfo class implements the IcustomerInfo interface.
>
> Implements ICustomerInfo
>
> Private CustomerNameValue As String ' Used to store the property value.
>
> Public Event UpdateComplete() Implements ICustomerInfo.UpdateComplete
>
> Public Property CustomerName() As String Implements _
>
> ICustomerInfo.CustomerName
>
> Get
>
> Return CustomerNameValue
>
> End Get
>
> Set(ByVal Value As String)
>
> ' The Value parameter is passed to the Set procedure
>
> ' when the contents of this property is modified.
>
> CustomerNameValue = Value ' Save the new value.
>
> End Set
>
> End Property
>
> Public Sub UpdateCustomerStatus() Implements _
>
> ICustomerInfo.UpdateCustomerStatus
>
> ' Add code here to update the status of this account.
>
> ' Raise an event to indicate that this method is done.
>
> RaiseEvent UpdateComplete()
>
> End Sub
>
> End Class
>
> The application doesn't compile.The are no build errors but I get the
> System.TypeLoadException error showing up every time.
> If I move the interface and class definition into WindowsApplication1, the
> application compile without any problem.
>
> If I remove the handler for event UpdateComplete, that is
>
> Private Sub cus_UpdateComplete() Handles cus.UpdateComplete
> End Sub
>
> the application compile without any problem as well.
>
> Is there a reason for this behaviour?
>
> Thanks a lot in advance.
>
> JL
>
>
>
>
>