列表框值不会更改 [英] Listbox value does not change

查看:92
本文介绍了列表框值不会更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



说我有一个列表框。我还在绑定到

列表框的表单上创建了一个控件。当我点击列表框中的不同行时,控件

会根据我点击的内容更改行的ID。


我正在做的一件事是将列表的.selected(i)属性设置为

框为true。在屏幕上我看到一个不同的行是有道理的,

但是表单上的绑定控件显示错误的值?


所以更改选中的内容与代码没有结果相同

如同列表框上的一样?这有什么意义吗?

Hi,
Say I have a list box. I also created a control on a form bound to that
list box. When I click different rows in the listbox the control
changes the ID of the row depending on what I click.

One thing I''m doing is setting the .selected(i) property of the list
box to true. On the screen I see that a different row gets hillighted,
but the bound control on the form is showing the wrong value?

So changing what is selected with code did not turn out to be the same
as cliking on the list box? Does this make any sense?

推荐答案

绝对。

也许你可以解释一下创建一个控件在一个绑定到

列表框的表格上。

因为这对我们所有人来说可能并不一样

和/或

发布您可能用于实现此绑定的任何代码将

帮助。

Absolutely.
Perhaps you could explain "created a control on a form bound to that
list box."
as this might not mean the same thing to all of us
and/or
posting any code that you may be using to effect this binding would
help.


ken写道:
ken wrote:

说我有一个列表框。我还在绑定到该列表框的表单上创建了一个控件。当我单击列表框中的不同行时,控件
会根据我点击的内容更改行的ID。

我正在做的一件事是设置.selected(i)属性列表
框为真。在屏幕上我看到一个不同的行是有道理的,
但是表单上的绑定控件显示错误的值?

所以用代码更改选择的内容并不是和列表框上的一样?这有什么意义吗?
Hi,
Say I have a list box. I also created a control on a form bound to that
list box. When I click different rows in the listbox the control
changes the ID of the row depending on what I click.

One thing I''m doing is setting the .selected(i) property of the list
box to true. On the screen I see that a different row gets hillighted,
but the bound control on the form is showing the wrong value?

So changing what is selected with code did not turn out to be the same
as cliking on the list box? Does this make any sense?



鼠标单击应设置Selected属性。你可能想要考虑的一件事就是将ColumnHeading设置为true。这可以抵消

你的行数是1.


The mouse click should set your Selected property. One thing you might
want to consider is if you have ColumnHeading set to true. That offsets
you row count by 1.




感谢您的回复。

嗯..我所指的控件是一个文本框。它的控制源是

= [LBox] .Value


这是我如何更改列表框LBox的选定属性:


For i = 0 To LBox.ListCount() - 1

如果LBox.Column(0,i)= Me.pkItem那么

LBox。选中(i)= True''这会改变

列表框中的高位值

结束如果

下一页

顺便说一下,这是一个选择列表框。只能选择一件事。


无论如何,在循环之后,我看到了高位行的变化。所以在我选择第5行(LBox.Value = 5)之前我已经选择了第5行(LBox.Value = 3)

之后。


然而我的文本框告诉我,我仍然选择第5行(LBox.Value = 5)



Hi,
Thanks for your reply.
Um..The control I''m refering to is a text box. Its Control Source is
=[LBox].Value

Here is how I change the selected property of the list box LBox:

For i = 0 To LBox.ListCount() - 1
If LBox.Column(0, i) = Me.pkItem Then
LBox.Selected(i) = True ''this changes the highlited value in the
list box
End If
Next
By the way this is a single select list box..can only select one thing.

Anyhow after that loop I see a change in the highlited row. So before I
had row 5(LBox.Value = 5) selected, after I had row 3 (LBox.Value = 3)
selected.

However my textbox tells me that I still have Row 5 (LBox.Value = 5)
selected?

这篇关于列表框值不会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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