1

I know how to handle a single objects property changed event very easily. I want to handle a objects property changed event that is part of another object.

Given Object:

[ObjectY = Y]
+ Public WithEvents X As ObjectX

I would like to do something like:

Private Sub XPropertyChanged() Handles Y.X.PropertyChanged

Right now I need to create a object that equals the object inside that object and then handle this variable pointers property changed, but that is just annoying. Is there any way to do something similar to the above?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Landin Martens
  • 3,283
  • 12
  • 43
  • 61
  • 1
    Do you have any hierarchical links between Objects? Or what you want to do is handle 2 totally different events with no link whatsoever? – Minus Jun 07 '12 at 18:12
  • So `ObjectY` and `ObjectX` derive from the same base classes? ...where is `Private Sub XPropertyChanged()...`? If ObjectY owns ObjectX, I recommend making the property public. Are these actual forms you are trying to work with ...e.g., FormA is supposed to handle an event from FormB's TextBox ...??? – IAbstract Jun 07 '12 at 18:12
  • Have each object implement `INotifyPropertyChanged` ...then it will become quite obvious how to bubble up the event from composite objects. – IAbstract Jun 07 '12 at 18:14
  • You may consider having a look at this - http://stackoverflow.com/a/4218764/763026 – Angshuman Agarwal Jun 07 '12 at 20:00

1 Answers1

0

Answer was a comment:

Have each object implement INotifyPropertyChanged ...then it will become quite obvious how to bubble up the event from composite objects.

Landin Martens
  • 3,283
  • 12
  • 43
  • 61