开发者

Hide Member Without Using Underscore

开发者 https://www.devze.com 2023-01-10 20:58 出处:网络
I have a class written in VB.Net exposed to COM via the ComClass & ComVisible attributes. The class is then made available to VBA via a TLB. In VB6 you could easily mark a member hidden in the obj

I have a class written in VB.Net exposed to COM via the ComClass & ComVisible attributes. The class is then made available to VBA via a TLB. In VB6 you could easily mark a member hidden in the object browser but still available with a check mark. In VB.Net the only way I found to make a member hidden the VBA object browser is开发者_如何学Python to prefixing the name with an underscore.

Is there a way to hide a member without underscoring it?


You might take a look at the BrowsableAttribute in System.ComponentModel namespace. Normally this hides a property or method from intellisense but it may also work for COM.

I don't use COM myself so can't really test it.

http://msdn.microsoft.com/en-us/library/system.componentmodel.browsableattribute.aspx


The only way I can think of is to manually edit the typelib created by Tlbexp/Regasm (using tools like Oleview and Midl) and add the [hidden] IDL attribute to the method.

0

精彩评论

暂无评论...
验证码 换一张
取 消