Problem with RaiseEvent - Again

F

ffa

I have a number of classes that declare a public Event called RefreshData:

Public Class Client
Implements INotifyPropertyChanged

Implements IDisposable

Implements IDataErrorInfo

Public Event PropertyChanged(ByVal sender As Object, ByVal e As
System.ComponentModel.PropertyChangedEventArgs) Implements
System.ComponentModel.INotifyPropertyChanged.PropertyChanged

Public Event ErrorMsg(ByVal ErrMsg As String)

Public Event RefreshData() '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Private WithEvents _ValidationRules As New Validation.brokenRules(Me)

<snip>

The event is reaised whenever the class does a data fetch:

<snip>

_Updated = CDate(IfNull(.Item("Updated"), Date.MinValue))

_Operator_ID = CInt(IfNull(.Item("Operator_ID"), 0))

End With

_Memo = New ClientMemo(_DatabaseName, _ID)

HasData = True

IsDirty = False

CanDelete = Can_Delete("Client", _ID, _DatabaseName)

RaiseEvent RefreshData() '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

In any form where this is used it is declared as follows:

Private WithEvents oClient As TRM8.WFL.Client

and is handled as follows:

Private Sub oClient_Refresh() Handles oClient.RefreshData

With oClient

mnuEditClient.Enabled = .HasData

End With

End Sub

The problem I am experiencing is that the "oClient_Refresh" method is no
longer being called (it was working). Added to this several other classes
with the same event are displaying the same behaviour. I have triple checked
my code and all appears well.

Has anyone seen this behaviour before? ....or can offer any suggestions.

Thank you
 
G

Guest

In the debugger, if you put a break point at the RaiseEvent RefreshData
statement, does everything look cool? In other words, when this happens to
me, usually something is going on deeper in the code and the event is never
raised.
 
F

ffa

Thanks Mike
Yes, I put a breakpoint where you suggested and the code just jumps to the
next statement in the class method without calling the "oClient_Refresh()
Handles oClient.RefreshData" method. Really wierd
 

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