vba 选择选项组中的项目后如何使文本框可见
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/682826/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to make TextBox visible after an item in an option group is selected
提问by Nick Sinas
This should be easy but for some reason it will not work. I have a form named MainForm and the selection in the Option Group I want to select is called PickMe.
这应该很容易,但由于某种原因它不起作用。我有一个名为 MainForm 的表单,我要选择的选项组中的选项称为 PickMe。
I have a text box called TxtHere that I set to not be visible.
我有一个名为 TxtHere 的文本框,我将它设置为不可见。
I wrote this:
我写了这个:
Private Sub PickMe_Click()
Me!TxtHere.Visible = True
End Sub
So it should set the text box to visible when I select PickMe but this does not work. Any ideas? I feel stupid for asking something so simple.
因此,当我选择 PickMe 时,它应该将文本框设置为可见,但这不起作用。有任何想法吗?问这么简单的事情,我觉得很愚蠢。
回答by Nick Sinas
I figured it out.
我想到了。
With a Option Group use:
使用选项组使用:
_MouseDown and Me.xxx.Visible = True
回答by David-W-Fenton
Er, with an option group, you should use the AfterUpdate() event of the option group, and then use a SELECT CASE to test the value returned by the option group.
呃,对于一个选项组,你应该使用选项组的AfterUpdate()事件,然后用一个SELECT CASE来测试选项组返回的值。