VBA和MS-Access中的Bang表示法和点表示法 [英] Bang Notation and Dot Notation in VBA and MS-Access

查看:91
本文介绍了VBA和MS-Access中的Bang表示法和点表示法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仔细阅读我正在文档的应用程序时,我已经在访问对象属性/方法等过程中遇到了爆炸符号的一些示例,在其他地方,它们出于相似的目的使用点符号.

While perusing an application that I'm documenting, I've run across some examples of bang notation in accessing object properties/methods, etc. and in other places they use dot notation for what seems like the same purpose.

使用一种或另一种是否有区别或偏好?一些简单的谷歌搜索只能显示关于该主题的有限信息,而有些人实际上是在相反的情况下使用它.也许在某个地方有来自MS的编码标准部分指出了疯狂的方法?

Is there a difference or preference to using one or the other? Some simple googling only reveals limited information on the subject with some people actually using it in opposite cases. Perhaps there is a coding standards section from MS somewhere that indicates the method of madness?

推荐答案

尽管已(以前)接受了该问题的答案,但实际上该爆炸不是成员或集合访问运算符.它做了一件简单而又具体的事情: bang运算符通过将bang运算符后的文字名称作为字符串参数传递给该默认成员,从而提供对对象默认成员的后期绑定访问.

Despite the (formerly) accepted answer to this question, the bang is not in fact a member or collection access operator. It does one simple and specific thing: The bang operator provides late-bound access to the default member of an object, by passing the literal name following the bang operator as a string argument to that default member.

就是这样.该对象不必是集合.它不必具有称为Item的方法或属性.它只需要一个Property GetFunction即可接受字符串作为第一个参数.

That's it. The object doesn't have to be a collection. It doesn't have to have a method or property called Item. All it needs is a Property Get or Function which can accept a string as the first argument.

有关更多详细信息和证明,请参阅我的博客文章讨论: <强>爆炸! (感叹号运算符)在VBA中

For much more detail and proof, see my blog post discussing this: The Bang! (Exclamation Operator) in VBA

这篇关于VBA和MS-Access中的Bang表示法和点表示法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆