PropertyChanged event with VB.NET (.NET 1.1)

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi.

I searched for hours now but can't find how to get the following to work:

A usercontrol with two properties (A and B).
If A is changed in the designer, B should be changed as well.
This works but the change in B is not instantly reflected in the
designer, it's only shown if you click on B and then the new value is shown.

In VB6 this works by calling PropertyChanged "B".
In VB.NET 2.0 this also works using some INotifyPropertyChanged thing.
But how does it work with VB.NET 1.1?

I even wrote a VB6 app (where everything worked) and then used the
upgrade manager from VB.NET to convert the project. It renamed the
events but the changes are not reflected in the designer as it did in VB6.

The only thing remotely helpful I found is this page
http://www.interact-sw.co.uk/iangblog/2004/10/23/propertychange
which seems a bit too complicated for such an easy(?) problem.

Public Class UC
Inherits System.Windows.Forms.UserControl

Private m_A as integer
Private m_B as integer

Public Property A As Integer
Get
Return m_A
End Get
Set(ByVal Value As Integer)
m_A = Value
m_B = m_A
End Set
End Property

Public Property B As Integer
Get
Return m_B
End Get
Set(ByVal Value As Integer)
m_B = Value
End Set
End Property

end class

Any help would be greatly appreciated
Mark
 
Do you have an example using the RefreshProperties Attribute? Sounds like
what I'm looking for in my usercontrol. Thanks for any help.
 
Imports System.ComponentModel

<RefreshProperties(RefreshProperties.All)> _
Public Property Enabled() As Boolean
Get
Return isEnabled
End Get
Set(ByVal Value As Boolean)
isEnabled = Value
End Set
End Property
 
Rocky said:
<RefreshProperties(RefreshProperties.All)> _
Public Property Enabled() As Boolean

I tried the RefreshProperties in front of the class definition and it
still did not work. Thanks for giving this easy example, that gave me
the important hint to use it directly with property.

Mark
 
Back
Top