hello
so I have this form which I populate with text boxes on runtime
To be alble to detect when user made change to the text box I am passing them withevents to the class and I want to handle the event inside the class.
So this is what I have:
Inside my class (cFakePositionTextBoxWrapper)
' declaration
Private WithEvents m_oTextBox As MSForms.TextBox
' pass text box
Public Sub AddTextBox(oTextBox As MSForms.TextBox)
Set m_oTextBox = oTextBox
End Sub
' capture event
Private Sub m_oTextBox_Change()
End Sub
And that's what I have in the form code:
Dim oTextBox As MSForms.TextBox
' add the text box
Set oTextBox = frmFakePosition.fraFakePositionsEdit.Controls.Add("Forms.TextBox.1", m_sCONTROL_POSITION_PREFIX & "_" & i & "_" & j, True)
' textbox wrapper
Dim oFakePositionTextBoxWrapper As cFakePositionTextBoxWrapper
Set oFakePositionTextBoxWrapper = New cFakePositionTextBoxWrapper
' pass text box to the wrapper
oFakePositionTextBoxWrapper.AddTextBox oTextBox
It works fine (i mean it doesnt error) but when I input data into the textbox - event is not captured.
Any ideas what I am doing wrong?
thank you
so I have this form which I populate with text boxes on runtime
To be alble to detect when user made change to the text box I am passing them withevents to the class and I want to handle the event inside the class.
So this is what I have:
Inside my class (cFakePositionTextBoxWrapper)
' declaration
Private WithEvents m_oTextBox As MSForms.TextBox
' pass text box
Public Sub AddTextBox(oTextBox As MSForms.TextBox)
Set m_oTextBox = oTextBox
End Sub
' capture event
Private Sub m_oTextBox_Change()
End Sub
And that's what I have in the form code:
Dim oTextBox As MSForms.TextBox
' add the text box
Set oTextBox = frmFakePosition.fraFakePositionsEdit.Controls.Add("Forms.TextBox.1", m_sCONTROL_POSITION_PREFIX & "_" & i & "_" & j, True)
' textbox wrapper
Dim oFakePositionTextBoxWrapper As cFakePositionTextBoxWrapper
Set oFakePositionTextBoxWrapper = New cFakePositionTextBoxWrapper
' pass text box to the wrapper
oFakePositionTextBoxWrapper.AddTextBox oTextBox
It works fine (i mean it doesnt error) but when I input data into the textbox - event is not captured.
Any ideas what I am doing wrong?
thank you