> I resorted to Bing's Copilot to discover that Scripting.Dictionary does NOT have a default method/property. But VB6 thinks it does.
Why don't you decompile the typelib to source IDL and check yourself? Start OleView.exe, choose File->View TypeLib, select C:\Windows\SysWOW64\scrrun.dll. In the source IDL find IDictionary interface declaration and search for DISPID = 0 i.e. this signifies default prop/method.
Here is the relevant snippet:
Yes, Item property is the default property. Lets look in VBx in Object Browser pane:Code:[ odl, uuid(42C642C1-97E1-11CF-978F-00A02463E06F), helpstring("Scripting.Dictionary Interface"), helpcontext(0x00214b22), hidden, dual, oleautomation ] interface IDictionary : IDispatch { [id(00000000), propputref, helpstring("Set or get the item for a given key"), helpcontext(0x00214b3a)] HRESULT Item( [in] VARIANT* Key, [in] VARIANT* pRetItem); [id(00000000), propput, helpstring("Set or get the item for a given key"), helpcontext(0x00214b3a)] HRESULT Item( [in] VARIANT* Key, [in] VARIANT* pRetItem); [id(00000000), propget, helpstring("Set or get the item for a given key"), helpcontext(0x00214b3a)] HRESULT Item( [in] VARIANT* Key, [out, retval] VARIANT* pRetItem); [id(0x00000001), helpstring("Add a new key and item to the dictionary."), helpcontext(0x00214b3c)] HRESULT Add( [in] VARIANT* Key, [in] VARIANT* Item); ...
Do you see the blue dot? This is the marker for default property and it's on Item property.
Now let's test TB some of the later BETAs (e.g. 546)
Both events work as expected.Code:Class Form1 Sub New() End Sub Private Sub Form_Load() Dim dict As Object Set dict = CreateObject("Scripting.Dictionary") dict("aaa") = 42 Debug.Print dict("aaa") End Sub Private Sub Form_Click() Dim dict As Dictionary Set dict = New Dictionary dict("aaa") = 42 Debug.Print dict("aaa") End Sub End Class
> Some guidance will be appreciated on how to approach this from people with background who are active on Discord.
You can approach this very easy -- just make a simple project with 10-20 lines of code which demostrates the problem, i.e. which clearly shows there is no default property on Dictionary in VBx or TB.
With TB this is even easier -- it's enough to come up with a snippet which works differently in VBx vs TB because the target of TB is to be 100% compatible with VBx which means bug for bug compatible, even wart for wart.
cheers,
</wqw>





Reply With Quote