作者:Amyb__ing舒 | 来源:互联网 | 2023-06-30 18:10
Ihaveauserformthatrequiresinputintovarioustextboxesandcomboboxes.Theinputsareformeas
I have a userform that requires input into various textboxes and comboboxes. The inputs are for measurements and have units associated with them. I want the userform to display which units are expected to be used when you click into each specific text/combobox.
我有一个userform,需要输入各种文本框和组合框。输入用于测量并具有与之相关的单元。我希望userform显示当您单击每个特定文本/组合框时预期使用的单位。
Currently, my code works for textboxes but does not recognize comboboxes. Here is my code.
目前,我的代码适用于文本框,但不识别组合框。这是我的代码。
Private Sub TextboxActions_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If InStr(1, TextboxActions.Name, "OD") > 0 Then
UserForm1.inUnit.Visible = True
UserForm1.mmUnit.Visible = False
UserForm1.eaUnit.Visible = False
ElseIf InStr(1, TextboxActions.Name, "CE") > 0 Then
UserForm1.inUnit.Visible = False
UserForm1.mmUnit.Visible = True
UserForm1.eaUnit.Visible = False
Else
UserForm1.inUnit.Visible = False
UserForm1.mmUnit.Visible = False
UserForm1.eaUnit.Visible = True
End If
End Sub
Using this, when the user clicks a textbox it will display the units in, mm, or ea. I want this to be the case for comboboxes as well, but currently nothing happens when clicking into a combobox.
使用此功能,当用户单击文本框时,它将以mm,mm或ea显示单位。我希望这也是组合框的情况,但是目前在点击组合框时没有任何反应。
2 个解决方案