bradyboyy88
Well-known Member
- Joined
- Feb 25, 2015
- Messages
- 562
Hi!
I have a close made with the code below but the AfterUpdate event does not seem to exist for a dynamically created textbox. Am I doing something wrong because the change event works perfectly fine.
Thanks
I have a close made with the code below but the AfterUpdate event does not seem to exist for a dynamically created textbox. Am I doing something wrong because the change event works perfectly fine.
Thanks
Code:
Public WithEvents New_TextBox As MSForms.TextBox
Public Sub New_TextBox_Change()
Msgbox "test"
End Sub
Sub CreateTextbox(FRAME As MSForms.FRAME, Text_Caption As String, Top_Position As Long, Left_Position As Long, Width_Value As Integer, Height_Value As Integer, Visible_Value As Boolean, TagValue As String, ColorChoice As Long, BackColorChoice As Long, Transparency As Boolean, IsLocked As Boolean, SpecialEffectSetting As Long)
Dim Control As MSForms.TextBox
Set Control = FRAME.Controls.Add("Forms.Textbox.1", , True)
With Control
.Width = Width_Value
.Left = Left_Position
.Top = Top_Position
.ForeColor = ColorChoice
.Height = Height_Value
.Tag = TagValue
'Excel glitch but this is the fix
.MultiLine = False 'Set MultiLine to False
.WordWrap = False 'Set WordWrap to False
.Text = Text_Caption
If Transparency = True Then
.BackStyle = fmBackStyleTransparent
Else
.BackColor = BackColorChoice
End If
If IsLocked Then
.Locked = True
End If
.SpecialEffect = SpecialEffectSetting
'Excel glitch but this is the fix
.MultiLine = True 'Set Multiline to True
.WordWrap = True 'Set WordWrap to True
.Visible = Visible_Value
'If Visible_Value = True Then .SetFocus
End With
'Update Counter
Control_Count = Control_Count + 1
'Assign New Control to Collection
NewControls.Add Control, Control.Name
NewControlsTag.Add "", Control.Name
Set DynamicControl = New DynamicControls
Set DynamicControl.New_TextBox = Control
NewControlsEvent.Add DynamicControl, Control.Name
End Sub