rick
July 11th, 2001, 10:44 AM
hi,
I'm tying to add a textbox object to a ClassModule WithEvents and I keep getting this error message,
"Object or class does not support the set of events"
I use to have this code in a VBA project an I need to move it to a VB project... The code worked fine in VBA.
Here is a bit of code to help...
Dim nTxtBox as Long
Dim txtbox as MSForms.TextBox
for i = LBound(vEntityNames) to UBound(vEntityNames)
tempStr = vEntityNames(i)
testEntity = validEntityCollection.Item(tempStr)
If Err.Number = 0 then
set myTextBox = new CEntityTxtBox
set myTextBox.SymbolForm = me
set myTextBox.S4WordDoc = m_S4WordDoc
nTxtBox = count - 1
set txtbox = TextBox1(nTxtBox)
set myTextBox.m_symboltext = txtbox
' the line above is where I'm getting the error message
myTextBox.m_symboltext.ToolTipText = vEntityNames(i)
tempEntityName = vEntityNames(i)
myTextBox.m_symboltext.Text = ChrW(m_pEntity.GetEntityCode(tempEntityName))
myTextBox.m_symboltext.BackColor = &H80000005
myTextBox.m_entityName = vEntityNames(i)
mycol.Add myTextBox
count = count + 1
End If
next i
If you are wondering why I use the MSForms.textbox it is because that is what I was using in the VBA code and I tried the VB.textbox but that did not work either, I got the same error.
this is the declaration in the textbox event class...
option Explicit
public withevents m_symboltext as MSForms.TextBox
' these are the event functions for the textbox object...
private Sub m_symboltext_DblClick(Cancel as MSForms.ReturnBoolean)
private Sub m_symboltext_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
Now for the Question...
How can I pass a textbox to an event class without getting the error message?!
Rick
rguay@i4i.com
www.i4i.com
I'm tying to add a textbox object to a ClassModule WithEvents and I keep getting this error message,
"Object or class does not support the set of events"
I use to have this code in a VBA project an I need to move it to a VB project... The code worked fine in VBA.
Here is a bit of code to help...
Dim nTxtBox as Long
Dim txtbox as MSForms.TextBox
for i = LBound(vEntityNames) to UBound(vEntityNames)
tempStr = vEntityNames(i)
testEntity = validEntityCollection.Item(tempStr)
If Err.Number = 0 then
set myTextBox = new CEntityTxtBox
set myTextBox.SymbolForm = me
set myTextBox.S4WordDoc = m_S4WordDoc
nTxtBox = count - 1
set txtbox = TextBox1(nTxtBox)
set myTextBox.m_symboltext = txtbox
' the line above is where I'm getting the error message
myTextBox.m_symboltext.ToolTipText = vEntityNames(i)
tempEntityName = vEntityNames(i)
myTextBox.m_symboltext.Text = ChrW(m_pEntity.GetEntityCode(tempEntityName))
myTextBox.m_symboltext.BackColor = &H80000005
myTextBox.m_entityName = vEntityNames(i)
mycol.Add myTextBox
count = count + 1
End If
next i
If you are wondering why I use the MSForms.textbox it is because that is what I was using in the VBA code and I tried the VB.textbox but that did not work either, I got the same error.
this is the declaration in the textbox event class...
option Explicit
public withevents m_symboltext as MSForms.TextBox
' these are the event functions for the textbox object...
private Sub m_symboltext_DblClick(Cancel as MSForms.ReturnBoolean)
private Sub m_symboltext_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
Now for the Question...
How can I pass a textbox to an event class without getting the error message?!
Rick
rguay@i4i.com
www.i4i.com