|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
PropertyChanged event with VB.NET (.NET 1.1)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 Use the RefreshProperties attribute
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemComponentModelRefreshPropertiesClassTopic.asp Show quoteHide quote "Mark" <n***@eggenstein.net> wrote in message news:eYuvRUaNGHA.3936@TK2MSFTNGP10.phx.gbl... > 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. -- Show quoteHide quoteDennis in Houston "Rocky" wrote: > Use the RefreshProperties attribute > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemComponentModelRefreshPropertiesClassTopic.asp > > "Mark" <n***@eggenstein.net> wrote in message > news:eYuvRUaNGHA.3936@TK2MSFTNGP10.phx.gbl... > > 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 > > > 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 Show quoteHide quote "Dennis" <Den***@discussions.microsoft.com> wrote in message news:7838F741-0893-4177-A24F-C16F93B5CEE2@microsoft.com... > Do you have an example using the RefreshProperties Attribute? Sounds like > what I'm looking for in my usercontrol. Thanks for any help. > -- > Dennis in Houston > > > "Rocky" wrote: > >> Use the RefreshProperties attribute >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemComponentModelRefreshPropertiesClassTopic.asp >> >> "Mark" <n***@eggenstein.net> wrote in message >> news:eYuvRUaNGHA.3936@TK2MSFTNGP10.phx.gbl... >> > 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 >> >> >> Rocky wrote:
> <RefreshProperties(RefreshProperties.All)> _ I tried the RefreshProperties in front of the class definition and it > Public Property Enabled() As Boolean still did not work. Thanks for giving this easy example, that gave me the important hint to use it directly with property. Mark Grrrrrrrrreat..thanks for the code..I've put it in my examples.
-- Show quoteHide quoteDennis in Houston "Rocky" wrote: > 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 > > > > "Dennis" <Den***@discussions.microsoft.com> wrote in message > news:7838F741-0893-4177-A24F-C16F93B5CEE2@microsoft.com... > > Do you have an example using the RefreshProperties Attribute? Sounds like > > what I'm looking for in my usercontrol. Thanks for any help. > > -- > > Dennis in Houston > > > > > > "Rocky" wrote: > > > >> Use the RefreshProperties attribute > >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemComponentModelRefreshPropertiesClassTopic.asp > >> > >> "Mark" <n***@eggenstein.net> wrote in message > >> news:eYuvRUaNGHA.3936@TK2MSFTNGP10.phx.gbl... > >> > 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 > >> > >> > >> > > >
Can opacity/transparency be adjusted within components?
Extract image dimensions (height, width) from Base64 String? DrawIconEx Basic DirectSound question System tray icon My Quiz Program Progress bar - No activity Basic How To Question: Class Library or Windows Control Library Shrinking Property Editor Description Dns.Resolve: Query Authoritive Server |
|||||||||||||||||||||||