使用CommandButton激活TextBox [英] Activating TextBox with a CommandButton

查看:86
本文介绍了使用CommandButton激活TextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在userform中有多个文本框,并希望使用命令按钮将文本输入到特定的文本框中。


例如:打开表单时,textbox1处于活动状态。所以当我点击一个按钮,文本显示在textbox1中。然后我点击下一步命令按钮和文本框2变为活动状态,因此当我单击按钮时,文本显示在textbox2中。我点击下一步按钮和文本框3变得活跃,等等。


我对VBA一无所知,所以我甚至不知道如何开始自己研究这个。如果我使用任何不正确的术语,我也会道歉。


非常感谢。

I have multiple textboxes in a userform and wish to enter text into a specific textbox with a command button.

For example: when the form is opened, textbox1 is "active" so when I click a button that text is displayed in textbox1. Then I click a "next" command button and textbox2 becomes active so when I click a button that text is displayed in textbox2. I click the "next" button and textbox3 becomes active, and so on.

I don''t really know anything about VBA so I don''t even know how to begin to research this on my own. I also apologize if I use any incorrect terminology.

Thanks so much.

推荐答案

我认为通过激活 ;你的意思是启用。如果enabled属性设置为false,它将显示为灰色,您无法单击它。要激活它,您可以将其enabled属性设置为True。
I think that by "Activate" you mean "Enable". If the enabled property is set to false, it will appear grayed out and you can''t click it. To activate it, you would set its enabled property to True.
展开 | 选择 | Wrap | 行号


很难解释我想要做什么。我会尝试更具体(也有屏幕截图):


这是我的用户形式。我想创建一个表格来评分花样滑冰项目(因此是技术元素)。一个示例滑冰程序将是(按照执行的技术要素的顺序):


1. 3F

2. 3F + 3T<

3.

...


因此,当执行第一个元素(三重翻转跳转)时,我想点击那个按钮(标记为3,在Flip行中)将该元素输入到文本框中。第二个元素是三重翻转三趾环组合跳跃,所以我想点击下一步转到第二个文本框并单击相应的按钮(翻转行中标记为3的按钮,然后是Toe Loop行中标记为3的按钮我想,而不是点击下一步,我可以点击进入文本框但是......这也适用于执行等级标记(-3,-2,-1,0,...)。


但是,我还需要能够适当地输入元素。如果可能,则需要输入+ 3T(或者组合中的第二次或第三次跳跃)但是如果3T本身,我只需要输入为3T。不是+ 3T。


或许这是不可能的?

It''s difficult to explain what exactly I want to do. I''ll try to be more specific (with a screen shot as well):

This is my userform. I''m wanting to create a form to score figure skating programs (hence the technical elements). An example skating program would be (in order of technical elements executed):

1. 3F
2. 3F+3T<
3.
...

Thus, when the first element (a triple flip jump) is executed, I want to click that button (labeled 3 in the Flip row) to input that element into the textbox. The second element is a triple flip-triple toe loop combination jump, so I want to click next to go to the second textbox and click the appropriate buttons (button labeled 3 in the Flip row followed by the button labeled 3 in the Toe Loop row), etc. I suppose instead of clicking next, I could just click into the textbox but... This applies for the Grade of Execution marks as well (the -3, -2, -1, 0, ...).

However, I also need to be able to input the elements appropriately. If it''s possible, it needs to be entered as +3T (or whatever the second or third jump in the combination is) BUT if the 3T is by itself, I only need it entered as "3T" not "+3T."

Or maybe this isn''t possible?


那是一个雄心勃勃的项目!


你的表单是一种工作方式;但是,在我看来你的数据库没有标准化请阅读:数据库规范化和表格结构


让我们看一下编号为1到13的列。

如果有只有一个元素在程序中才会填充第一个框?

如果有两个元素,那么第一个元素将在第一个框中,然后第二个元素将在第二个框中以及第一个框中的元素(将第一个框中的条目与第二个框中的新值连接起来)

如果有第三个元素,那么第三个框中的条目将是条目的连接第二个框用新元素,这样字符串就有三个值(3F + 3T + 1S ......)


我能理解正确吗?


你想做什么是可能的;但是,一旦您了解了数据库的规范化,就可能有一种更简单的方法。
That is an ambitious project there!

Your form is one way to work this; however, it seems to me that your database isn''t normalized please read: Database Normalization and Table Structures .

Let''s take a look at your column numbered one thru thirteen.
If there is only one element in the program then only the first box would be filled?
If there are two elements then the first element would be in box one, and then the second element would be in box two along with the element in box one (concatenating the entry in box one with the new value for entry into box two)
If there were a third element then the entry in box three would be the concatenation of the entry in box two with the new element so that the string would have three values (3F+3T+1S...)

Do I understand that correctly?

What you want done is possible; however, there may be an easier method once you have read about the normalization of the database.


这篇关于使用CommandButton激活TextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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