vba - 如何创建标签文本框,如 html 标签(在 ms 访问表单中)
解决方案
你可以使用一个类,像这样。它需要做一些工作,但这是我要开始的地方。不处于设计模式时无法添加控件,因此您期望的动态解决方案可能是不可能的。
一个类叫clsTagTextbox
Option Explicit
Private WithEvents tb As TextBox
Private lbl As Label
Private dicTags As Scripting.Dictionary
Public Function Initialise(tbTagTextBoxElement As TextBox, _
lblLabelForTags As Label)
Set tb = tbTagTextBoxElement
Set lbl = lblLabelForTags
Set dicTags = New Scripting.Dictionary
End Function
Private Sub tb_Exit(Cancel As Integer)
If Not dicTags.Exists(tb.Text) Then
dicTags.Add tb.Text, dicTags.Count
lbl.Caption = Join(dicTags.Keys(), ",")
End If
tb.Text = ""
End Sub
然后在你的表单中,你有一个标签和一个文本框,我的是txtTagBox
,lblTags
我有代码
Private c As clsTagTextbox
Private Sub Form_Load()
Set c = New clsTagTextbox
c.Initialise Me.txtTagBox, Me.lblTags
End Sub
推荐阅读
- internationalization - 如何在 SAPUI5 上的 i18n.properties 文件中包含 .properties 文件?
- api - 在 POSTMAN 中保护生产 API 的客户端机密和客户端 ID
- sql - Clickhouse,创建十进制类型的字典
- excel - Excel VBA 宏中的多个运行时错误以在两张工作表之间发送数据
- python - 在 Python 中使用 Pandas 处理对于 Excel 来说太大的数据集
- php - 计算mysql中连续行之间的日期差
- sql - SQL Server 如何执行事务脚本?(同样的问题需要完全不同的时间来执行)
- node.js - 无法为多个配置实例化 paypal sdk
- laravel - 如何检索其类别与laravel中当前帖子相同的帖子?
- laravel - 转储($_ENV)在 laravel 版本 7x 中不起作用