notSupportedException raising an event

T

Trapulo

I've a strange error with CF 2.0: when I make a raiseEvent, I get a
notsuportedexception execption, and I cannot figure why this.

This is my code:

Public Event DataReceived(ByVal sender As Object, ByVal e As
DataReceivedEventArgs)

Protected Sub OnDataReceived(ByVal sender As Object, ByVal e As
DataReceivedEventArgs)

Try

RaiseEvent DataReceived(sender, e) '<----- here I've the error

Catch ex As Exception

Debug.WriteLine("errore sollevando l'evento: " & ex.Message)

End Try

End Sub

Public Class DataReceivedEventArgs

Inherits EventArgs

Public Sub New(ByVal data As String)

Me._data = data

End Sub

Private _data As String

Public ReadOnly Property Data() As String

Get

Return _data

End Get

End Property



The function is called by an other function that is a callback of a
networkstream.beginRead process.



Any idea?



Thanks
 
T

Trapulo

Thank you, but I'm not updating UI. When I update UI from a callback I
always use a me.invoke from the control....
 
T

Trapulo

If can be useful, this is the code that event's hanlder try to run:

Protected Sub OnDataReceived(ByVal sender As Object, ByVal e As
PalmBusSocket.DataReceivedEventArgs)

Dim executor As New ExecuteCommandDelegate(AddressOf ExecuteCommand)

executor.BeginInvoke(e.Data, Nothing, e.Data)

End Sub



However, I've not exception from this code, but from the raiseevent command
in calling class.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top