引用表单上的控件(Dot v Bang) [英] Referencing Controls on a Form (Dot v Bang)

查看:68
本文介绍了引用表单上的控件(Dot v Bang)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


...首先,当您在目前所在的表格上攻击控件时,您应该始终使用我来引用它!


如:我!txtPassword.SetFocus

...
...First whenever reffering to a control on a form you are currently in then you should always refer to it by using Me!

Such as: Me!txtPassword.SetFocus
...



听起来好像你知道你在哪里来自。

没有太多劫持线程,你在Me.Control对我的立场是什么!控制?

直到最近,我会说我!是正确的方法(当然一般都是工作)。然后我认为,尽管控件不是Access.Form类的定义属性,但它们 Form_YourFormName''derived''类的已定义属性。我对你的评论感兴趣。

You sound as if you know where you''re coming from.
Without hijacking the thread too much, What is your position on Me.Control versus Me!Control?
Until recently, I would have said Me! was the correct way (both work generally of course). Then I considered that, although the controls are not defined properties of an Access.Form class, they are defined properties of the Form_YourFormName ''derived'' class. I''d be interested in your comments.

推荐答案

NeoPa

直到最近?改变了你的观点...除非最新版本中有一些我不知道的东西,而且据我所知它基本上是正确的编码方式。多年来,我继承了许多数据库,并且遇到过这种编码实践的问题。


以下是一些引用控件的不同方法。

我读过的文章明确指出ME!Control比me.controls更快("控制)或其他方法虽然我经常使用我(myVariable)来改变多个控件的属性以用于动态目的。

http://msdn2.microsoft.com/en-us/lib...ffice.11​​)。 aspx



NeoPa

直到最近?改变了你的观点...除非最新版本中有一些我不知道的东西,而且据我所知它基本上是正确的编码方式。多年来,我继承了许多数据库,并且遇到过这种编码实践的问题。
NeoPa
Until recently? Changed your oppinion... Unless there is something in the most recent version that i''m unaware of and from what I know it is basically the proper way of coding. I have inherited many databases over the years and have had issues with such coding practices.



是的。最近,在看到它使用两种方式之后,我试图弄清楚自己哪种是正确的方式。 MS通常提供多种引用方式,这也不例外。

Yes. Recently, after seeing it used both ways, I tried to figure out for myself which is the ''correct'' way. MS often provide more than one way to reference something and this is no exception.


以下是一些引用控件的不同方法。

我已经阅读了明确说明ME!Control比me.controls(Control)或其他方法更快的文章,尽管我经常使用我(myVariable)来更改多个控件的属性以用于动态目的。
Here are some different ways of refering to controls.
I have read articles that explicitly state that ME!Control is quicker than me.controls("Control") or other methods although I do use me(myVariable) quite often to change properties on a number of controls for dynamic purposes.



我的兴趣不在于我之间的比较! &安培;各种其他方法(没有性能问题的论据引用btw),但在我之间! &安培;我。具体来说。

My interest is not so much in the comparison between Me! & various other methods (No arguments with performance issues quoted btw), but between Me! & Me. specifically.

http://msdn2.microsoft.com/en-us/lib...ffice.11​​).aspx



感谢此链接。听起来好像是我!绝对是指定控件的单个命名实例的最正确方法。不幸的是,它仍然没有回答问题。

Thanks for this link. It does sound as if the Me! is absolutely the ''most'' correct way to specify an individual named instance of a control. Unfortunately, it still leaves questions unanswered.

  1. 为什么我。完全没有工作?
  2. 为什么属性列表仅在Me时显示在VBA窗口中。使用?
  3. 如果数据库中的设计表单(为方便起见,我们称之为[frmThis])是派生类(来自Form类),那么表单上的控件就是[Form_frmThis]类本身肯定 - 以及作为控件集合的成员(但不限于此)?

我不能不觉得有人在某处错过了某些东西(是的,甚至有人来自MS本身可能 - 在最好的时候,内部沟通在大型组织中很少是完美的。)


在我签字之前,让我感谢你的回复。虽然我很少接受任何有价值的东西,但我仍然感谢你的回答:)

I can''t help feeling that someone has missed something somewhere (Yes, even someone from MS itself possibly - Internal communication is rarely perfect in large organisations at the best of times).

Before I sign off, let me thank you for responding. Though I rarely accept anything at face value, I still appreciate your response :)


大声笑,是的,这让我很长一段时间,因为我自学成才并使用编程多年我想计算并且目前正在签订办公自动化的长期合同。我倾向于尽可能多地研究那些陷入困境的事物(任何事情)。


好​​吧,据我所知,它是一个属性,但也是一个对象,但是当你把它称为属性时,你会使用我。作为对象我! yada yada因此我!mycontrol.setfocus应该是一个gaurantee me.mycontrol一般不应该但有时会(我猜自动纠正)。


1.好吧虽然不是百分之百但是很确定我的原因。将它作为对象引用时的工作原理是因为MS访问灵活性和程序的自动更正功能。由于必须考虑到这一点,我很确定我!不仅会更直接,而且更快。


2.期间让程序知道您正在访问正在使用的对象的属性,从而显示属性窗口。 />

3.如果我理解正确,我相信我在本文前面已经同意。


非常欢迎您,我很乐意回复我希望你不要介意我引用你,但我也很少接受任何有价值的东西,我很乐意分享我的观点或知识。感谢您的提问。

:)
LOL, Yes this had me for a long time and since I am self taught and using programming for more years than I want to count and currently on a long term contract for office automation. I tend to do as much research as possible for things (ANYTHING) that get under my claw.

OK from what I understand it is a property but also an object however when you are referring to it as a property you would use the me. as an object me! yada yada Therefore me!mycontrol.setfocus should be a gaurantee where me.mycontrol generally shouldn''t but sometimes will (I am guessing auto correct).

1. OK although not a hundred percent but pretty sure that the reason me. works when referring to it as an object is because of MS accesses flexibility and the autocorrect functions of the program. Since this would have to be taken into consideration i am quite sure that Me! would not only be more direct but quicker.

2. The period lets the program know that you are accessing the properties of the object you are using thus the properties window is displayed.

3. If I understand correctly I believe I agreed earlier in this post.

You are quite welcome and I am more than happy to respond I hope you don''t mind me quoting you but I also rarely accept anything at face value, and I am more than happy to share my views and or knowledge. Thanks for the questions.
:)


这篇关于引用表单上的控件(Dot v Bang)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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