如何将文本框和标签添加到用户表单中的框架? [英] How to add text boxes and labels to a frame within a userform?

查看:25
本文介绍了如何将文本框和标签添加到用户表单中的框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个用户表单.在我选择产品代码并输入数量后,我希望此代码出现在与输入的数字一样多的框架中,并且我希望创建一个用于输入到期日期的文本框.你可以看到我的目标是什么.

I am trying to create a userform. After I select the product code and enter the quantity, I want this code to appear in the frame as many as the number entered, and I want a TextBox to be created for entering the expiration date. You can see what ı am aiming at the pictures.

这是我的用户表单的主要结构.添加产品代码和数量后应该是这样的.

推荐答案

您的目标雄心勃勃,一点也不简单.我可以给你一些提示,但你必须完成它.

Your goal is ambitious and isn't simple at all. I can give you some hints but you will have to complete it.

所以要回答您的原始问题,您可以通过这种方式在框架中定义控件:

So to answer your original question, you can define controls in a frame this way:

Dim tb as Object, lb as Object
Set tb = Frame1.Controls.Add("forms.textbox.1")
Set lb = Frame1.Controls.Add("forms.label.1")
lb.caption = <the recently entered product code>
lb.top = <you need to keep track of position of next entry>
lb.left = 50            ' from the left border of frame1
tb.top = lb.top
tb.left = lb.left + 100

然后您必须将文本框存储在一个集合(或数组,如您所愿)中以处理输入的到期日期.

Then you have to store the textboxes in a collection (or array, as you wish) to process the expiration dates entered.

又快又快.请注意,您必须实现更多功能才能使您的应用程序健壮可靠.

Shortly and quickly. Please note that you will have to implement many more functions to make your app robust and reliable.

这篇关于如何将文本框和标签添加到用户表单中的框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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