This is what i'm getting in the Type instance details
Myriad.Controls FilterBar #61,149._cboFilterColumn
Myriad.Controls DataGridView #61,148
Microsoft.Win32 UserPreferenceChangedEventHandler #67,071._target
Microsoft.Win32 SystemEvents.SystemEventInvokeInfo #67,072._delegate
Microsoft.Win32 SystemEvents.SystemEventInvokeInfo #60,685
System.Collections.Generic List<SystemEvents.SystemEventInvokeInfo> #6,591._items
System.Collections.Generic Dictionary<object, List<SystemEvents.SystemEventInvokeInfo>>.Entry #6,531.value
System.Collections.Generic Dictionary<object, List<SystemEvents.SystemEventInvokeInfo>> #6,533.entries
Microsoft.Win32 SystemEvents _handlers
Double clicking on the SystemEvents.SystemEventInvokeInfo line gives me
Which to me indicates that an event handler is being added for UserPreferenceChanged, but our application does not add this event it seams to occur when changing properties on the datagrid.
Am I correct so far. I now want to remove this system event so that the object can be dispoed, i'm currently trying to use the following code in the Dispose event but it does not appear to work
Dim eventHandler As UserPreferenceChangedEventHandler = CType(System.Delegate.CreateDelegate(GetType(UserPreferenceChangedEventHandler), mDGV, "OnUserPreferenceChanged"), UserPreferenceChangedEventHandler)
RemoveHandler SystemEvents.UserPreferenceChanged, eventHandler
mDGV is the DataGridView being referenced in the control.
Can anyone give me any advice. I need to help in VB.Net code as this is what we use for our application.
The root path tells me that the datagrid is implemented by Myriad.Controls.DataGridView. How is this class related to the System.Windows.Forms.DataGridView? Is it derived from the WinForms class? As far as I could see, the System.Windows.Forms.DataGridView does not add any event handlers to UserPreferencesChanged in the constructor, so I assume that the DataGridView in the allocation stack is the Myriad.Controls.DataGridView. Is that correct?
Without knowing more about the implementation of Myriad.Controls.DataGridView it's hard to tell why your fix doesn't work. Are you sure the event handler is hooked to the "OnUserPreferencesChanged" method?
SciTech Software AB
Users browsing this forum: Google [Bot] and 10 guests