捕获未绑定表单控件的值 [英] Capture Unbound Form Control's Value

查看:49
本文介绍了捕获未绑定表单控件的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我正在尝试捕获控件值:具有两个

选项(红色或蓝色)的下拉框保持返回值红色。即使

" Blue"被选中了?

Hello. I''m trying to capture a controls value: a dropdown box with two
selections (either "Red" or "Blue") keeps returning the value "Red" even if
"Blue" is selected?

推荐答案

10月5日下午12:36,Donald Fisher

< DonaldFis ... @ discussion.microsoft.comwrote:
On Oct 5, 12:36 pm, Donald Fisher
<DonaldFis...@discussions.microsoft.comwrote:

您好。我正在尝试捕获控件值:具有两个

选项(红色或蓝色)的下拉框保持返回值红色。即使

" Blue"被选中了?
Hello. I''m trying to capture a controls value: a dropdown box with two
selections (either "Red" or "Blue") keeps returning the value "Red" even if
"Blue" is selected?



唐纳德,您使用哪个属性来访问该值?你可以在你的代码中发布
吗?

Donald, which property are you using to access the value? Could you
post you code as well?


说我有一个控件CboColor在带有ITEMS的表格上收集设置为

list''Red''和''Blue''以及TEXT值设置为红色。我试图通过代码获得

控件的价值:


Dim strCboColorVal

strCboColorVal = Me .CboColor.Text()


然后检查它是否正常工作:


Debug.Print(strCboColorVal)


即使在下拉框中选择了''Blue'',也会出现''Red''的值。


" Charlie Brown"写道:
Say I have a control "CboColor" on a form with the "ITEMS" collection set to
list ''Red'' and ''Blue'' and the "TEXT" value set to ''Red''. I''m trying to get
the value of the control via code as such:

Dim strCboColorVal
strCboColorVal = Me.CboColor.Text()

Then to check if it''s working:

Debug.Print(strCboColorVal)

And the value ''Red'' occurs even if ''Blue'' is selected in the dropdown box.

"Charlie Brown" wrote:

10月5日下午12:36,Donald Fisher

< DonaldFis ... @ discussion.microsoft.comwrote:
On Oct 5, 12:36 pm, Donald Fisher
<DonaldFis...@discussions.microsoft.comwrote:

你好。我正在尝试捕获控件值:具有两个

选项(红色或蓝色)的下拉框保持返回值红色。即使

" Blue"被选中了?
Hello. I''m trying to capture a controls value: a dropdown box with two
selections (either "Red" or "Blue") keeps returning the value "Red" even if
"Blue" is selected?



唐纳德,您使用哪个属性来访问该值?你可以在你的代码上发布
吗?


Donald, which property are you using to access the value? Could you
post you code as well?


10月5日下午1:42,Donald Fisher

< DonaldFis ... @ discuss.microsoft.comwrote:
On Oct 5, 1:42 pm, Donald Fisher
<DonaldFis...@discussions.microsoft.comwrote:

假设我有一个控件CboColor在带有ITEMS的表格上收集设置为

list''Red''和''Blue''以及TEXT值设置为红色。我试图通过代码获得

控件的价值:


Dim strCboColorVal

strCboColorVal = Me .CboColor.Text()


然后检查它是否正常工作:


Debug.Print(strCboColorVal)


即使在下拉框中选择了''Blue'',也会出现''Red''的值。


" Charlie Brown"写道:
Say I have a control "CboColor" on a form with the "ITEMS" collection set to
list ''Red'' and ''Blue'' and the "TEXT" value set to ''Red''. I''m trying to get
the value of the control via code as such:

Dim strCboColorVal
strCboColorVal = Me.CboColor.Text()

Then to check if it''s working:

Debug.Print(strCboColorVal)

And the value ''Red'' occurs even if ''Blue'' is selected in the dropdown box.

"Charlie Brown" wrote:

10月5日下午12:36,Donald Fisher

< DonaldFis ... @ discussion.microsoft.comwrote:
On Oct 5, 12:36 pm, Donald Fisher
<DonaldFis...@discussions.microsoft.comwrote:

你好。我正在尝试捕获控件值:具有两个

选项(红色或蓝色)的下拉框保持返回值红色。即使

" Blue"被选中了?
Hello. I''m trying to capture a controls value: a dropdown box with two
selections (either "Red" or "Blue") keeps returning the value "Red" even if
"Blue" is selected?


唐纳德,您使用哪个属性来访问该值?你可以在你的代码中发布
吗? - 隐藏引用的文字 -
Donald, which property are you using to access the value? Could you
post you code as well?- Hide quoted text -



- 显示引用的文字 -


- Show quoted text -



尝试使用...


strCboColorVal = Me.CboColor.SelectedItem.Text

Try using...

strCboColorVal = Me.CboColor.SelectedItem.Text


这篇关于捕获未绑定表单控件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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