这是VB中的错误吗? [英] Is this a bug in VB?

查看:53
本文介绍了这是VB中的错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在表单上的组合框''On Click''事件中编写一些VB代码。当从

可用下拉列表中点击选择时,会发生事件触发
。这是关于我期望发生的事情和

所以我的代码运行得很好。


但是,如果在框中进行任何编辑(即不要不要从列表中选择

,只需输入我自己的条目,或者可以从下拉列表中对所选内容进行更改

)然后点击一些对表单的其他控制,

然后''点击''事件为组合框触发? (它看起来更像是一个'b $ b''迷失焦点''事件给我!)。


这是VB中的一些错误还是我误解了这个事件?我已经去了微软用于办公室更新的网站,它说的一切都是最新的。


谢谢,

Gord

I am writing some VB code in a combo box''s ''On Click'' event on a form. It
would appear the event fires when a selection is clicked on from the
available drop down list. This is about what I would expect to happen and
so my code runs just fine.

However, if any editing is done in the box (i.e. don''t select from the list
and just type my own entry, or perhaps make changes to what was selected
from the drop down list) and then I click on some other control on the form,
then the ''On Click'' event fires for the combo box? (It looks more like a
''Lost Focus'' event to me!).

Is this some bug in VB or am I misunderstanding the event? I''ve gone to
Microsoft''s web for Office updates and it says everything''s up to date.

Thanks,

Gord

推荐答案

这对我来说是个新人。您是否检查过以确保没有其他

事件背后有代码?对我来说听起来像是一个LostFocus事件。


Bonnie
http://www.dataplus-svc.com


Gord写道:
That''s a new one on me Gord. Did you check to make sure there are no other
events with code behind them? Sounds like an LostFocus event to me also.

Bonnie
http://www.dataplus-svc.com

Gord wrote:

>我正在表单上的组合框''On Click''事件中编写一些VB代码。当从
可用下拉列表中单击选择时,它将显示事件触发。这是关于我期望发生的事情和
所以我的代码运行得很好。

然而,如果在框中进行任何编辑(即不要从列表中选择<只需键入我自己的条目,或者可以从下拉列表中对所选内容进行更改,然后单击表单上的其他控件,然后点击点击 ''组合框会引发事件? (它看起来更像是''迷失焦点''事件给我!)。

这是VB中的一些错误还是我误解了这个事件?我已经去了微软办公室更新的网页,它说所有内容都是最新的。

谢谢,

Gord
>I am writing some VB code in a combo box''s ''On Click'' event on a form. It
would appear the event fires when a selection is clicked on from the
available drop down list. This is about what I would expect to happen and
so my code runs just fine.

However, if any editing is done in the box (i.e. don''t select from the list
and just type my own entry, or perhaps make changes to what was selected
from the drop down list) and then I click on some other control on the form,
then the ''On Click'' event fires for the combo box? (It looks more like a
''Lost Focus'' event to me!).

Is this some bug in VB or am I misunderstanding the event? I''ve gone to
Microsoft''s web for Office updates and it says everything''s up to date.

Thanks,

Gord



-

通过AccessMonster.com发布消息
http://www.accessmonster.com/Uwe/For...ccess/200808/1

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200808/1


Gord写道:
Gord wrote:

我在组合框中编写了一些VB代码'表格上的'点击''事件。当从

可用下拉列表中点击选择时,会发生事件触发
。这是关于我期望发生的事情和

所以我的代码运行得很好。


但是,如果在框中进行任何编辑(即不要不要从列表中选择

,只需输入我自己的条目,或者可以从下拉列表中对所选内容进行更改

)然后点击一些对表单的其他控制,

然后''点击''事件为组合框触发? (它看起来更像是一个'b $ b''迷失焦点''事件给我!)。


这是VB中的一些错误还是我误解了这个事件?我已经去了微软用于办公室更新的网站,它说的一切都是最新的。


谢谢,

Gord

I am writing some VB code in a combo box''s ''On Click'' event on a form. It
would appear the event fires when a selection is clicked on from the
available drop down list. This is about what I would expect to happen and
so my code runs just fine.

However, if any editing is done in the box (i.e. don''t select from the list
and just type my own entry, or perhaps make changes to what was selected
from the drop down list) and then I click on some other control on the form,
then the ''On Click'' event fires for the combo box? (It looks more like a
''Lost Focus'' event to me!).

Is this some bug in VB or am I misunderstanding the event? I''ve gone to
Microsoft''s web for Office updates and it says everything''s up to date.

Thanks,

Gord



我创建了一个新表格; A97。 2控制;与价值观相结合; 1,2,3,4

和一个关闭表格的命令按钮。


如果我在两个控件之间切换并通过输入<更改值br />
1,2,3,4它执行点击或更新后事件,具体取决于输入的

值。与单击下拉值并选择相同。

Private Sub Combo0_AfterUpdate()

如果Me.Combo0< 3然后MsgBoxAfter Less than 3

End Sub

Private Sub Combo0_Click()

If Me.Combo0 2 Then MsgBox"点击大于2

结束子


我将代码更改为

Private Sub Combo0_AfterUpdate()

如果Me.Combo0< 3然后

MsgBox小于3后

否则

MsgBox大于2后

结束如果

结束Sub

Private Sub Combo0_Click()

如果Me.Combo0 2那么

MsgBox" ;点击大于2

否则

MsgBox点击小于3

结束如果

结束Sub


它总是执行AfterUpdate然后执行Click事件;输入

值并通过鼠标选项卡或从下拉列表中选择值。


这是'A97帮助说的

对于控件,当用户发生此事件时:


·用鼠标左键单击控件。点击带有

的控件,鼠标右键或鼠标中键不会触发此事件。

·用鼠标左键单击包含超链接数据的控件。

使用鼠标右键或鼠标中键单击一个控件不会触发此事件
。当用户将鼠标指针移动到包含超链接数据的控件

上时,鼠标指针变为手状态。图标。

当用户点击鼠标按钮时,超链接被激活,然后

然后发生Click事件。


·选择组合框或列表框中的项目,方法是按

箭头键,然后按ENTER键或单击鼠标按钮。

·按空格键当命令按钮,复选框,选项按钮或

切换按钮具有焦点时。

·在具有命令按钮的表单上按下ENTER键/>
默认属性设置为是。


·在具有命令按钮的表单上按ESC键,其中取消

属性为设为是。

·按下控件的访问键。例如,如果命令按钮的'/ b $ b Caption属性设置为& Go,按ALT + G会触发事件。


当我改变时价值和标签...我没有看到列为行动

将激活OnClick事件。


这是一个错误吗?我会让专家决定。

I created a new form; A97. 2 Controls; Combo with with values; 1,2,3,4
and a command button to close the form.

If I tab between the two controls and change the value by entering
1,2,3,4 it executes the click or after update event depending on the
value entered. Same with clicking on the dropdown values and selecting.
Private Sub Combo0_AfterUpdate()
If Me.Combo0 < 3 Then MsgBox "After Less than 3"
End Sub
Private Sub Combo0_Click()
If Me.Combo0 2 Then MsgBox "Click Greater than 2"
End Sub

I changed the code to
Private Sub Combo0_AfterUpdate()
If Me.Combo0 < 3 Then
MsgBox "After Less than 3"
Else
MsgBox "After Greater than 2"
End If
End Sub
Private Sub Combo0_Click()
If Me.Combo0 2 Then
MsgBox "Click Greater than 2"
Else
MsgBox "Click Less than 3"
End If
End Sub

It always executed the AfterUpdate then the Click event; by entering the
values and tabbing or selecting the values from the dropdown via the mouse.

Here''s what A97 help says
For a control, this event occurs when the user:

· Clicks a control with the left mouse button. Clicking a control with
the right or middle mouse button does not trigger this event.
· Clicks a control containing hyperlink data with the left mouse button.
Clicking a control with the right or middle mouse button does not
trigger this event. When the user moves the mouse pointer over a control
containing hyperlink data, the mouse pointer changes to a "hand" icon.
When the user clicks the mouse button, the hyperlink is activated, and
then the Click event occurs.

· Selects an item in a combo box or list box, either by pressing the
arrow keys and then pressing the ENTER key or by clicking the mouse button.
· Presses SPACEBAR when a command button, check box, option button, or
toggle button has the focus.
· Presses the ENTER key on a form that has a command button whose
Default property is set to Yes.

· Presses the ESC key on a form that has a command button whose Cancel
property is set to Yes.
· Presses a control''s access key. For example, if a command button''s
Caption property is set to &Go, pressing ALT+G triggers the event.

When I change the value and tab...I don''t see that listed as an action
that would activate the OnClick event.

Is it a bug? I''ll let the experts decide.


没有其他代码。我简化了一切以消除变量。

只需在表单上放一个组合框和一些其他控件(组合甚至不需要
需要源列表)。放一个''msgbox"这个组合在组合的点击事件中执行了它的点击

事件'''。现在运行表单并在组合中键入

,然后单击另一个控件。你会看到

我的意思。


谢谢,


Gord


那么,我正在使用Access 2007.


" bhicks11 via AccessMonster.com" < u44327 @ uwewrote in message

news:88702e8eec2bc @ uwe ...
There''s no other code. I simplified everything to eliminate variables.
Just put a combo box and some other control on a form (combo doesn''t even
need source for a list). Put a ''msgbox "This combo executed its click
event"'' in the click event of the combo. Now run the form and type
something into the combo, then click on the other control. You''ll see what
I mean.

Thanks,

Gord

By the way, I''m using Access 2007.

"bhicks11 via AccessMonster.com" <u44327@uwewrote in message
news:88702e8eec2bc@uwe...

这对我来说是个新人。您是否检查确定没有

其他

事件及其后面的代码?对我来说听起来像是一个LostFocus事件。


Bonnie
http://www.dataplus-svc.com


Gord写道:
That''s a new one on me Gord. Did you check to make sure there are no
other
events with code behind them? Sounds like an LostFocus event to me also.

Bonnie
http://www.dataplus-svc.com

Gord wrote:

>>我正在表单上的组合框''On Click''事件中编写一些VB代码。当从
可用下拉列表中单击选择时,它将显示事件触发。这是关于我期望发生的事情和
所以我的代码运行得很好。

然而,如果在框中进行任何编辑(即不要从列表
然后只需输入我自己的条目,或者从下拉列表中对所选内容进行更改,然后点击
表单上的其他控件,
这是VB中的一些错误还是我误解了这个事件?我已经去了微软办公室更新的网页,它说所有内容都是最新的。

谢谢,

Gord
>>I am writing some VB code in a combo box''s ''On Click'' event on a form. It
would appear the event fires when a selection is clicked on from the
available drop down list. This is about what I would expect to happen and
so my code runs just fine.

However, if any editing is done in the box (i.e. don''t select from the
list
and just type my own entry, or perhaps make changes to what was selected
from the drop down list) and then I click on some other control on the
form,
then the ''On Click'' event fires for the combo box? (It looks more like a
''Lost Focus'' event to me!).

Is this some bug in VB or am I misunderstanding the event? I''ve gone to
Microsoft''s web for Office updates and it says everything''s up to date.

Thanks,

Gord



-

通过AccessMonster.com发布消息
http://www.accessmonster.com/Uwe/For...ccess/200808/1



这篇关于这是VB中的错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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