|
-
July 11th, 2001, 10:44 AM
#1
Error applying textbox to event ClassModule
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
[email protected]
www.i4i.com
-
July 11th, 2001, 10:44 AM
#2
Error applying textbox to event ClassModule
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
[email protected]
www.i4i.com
-
July 11th, 2001, 01:14 PM
#3
Re: Error applying textbox to event ClassModule
I may be wrong on this but a TextBox requires a container in which to reside such as a form, Picturebox, frame, etc. A Class module has none of these.
I am unfamiliar with VBA so I can not elaborate on the differences.
John G
-
July 11th, 2001, 01:42 PM
#4
Re: Error applying textbox to event ClassModule
Hey John,
Thanks for responding... I found my problem and though that you might be interested.
One thing I did not mention was that I have 128 textboxs and they were in a textbox collection. I just figured out that you cannot pass a textbox from an array (collection) to an event class if I add the textboxs one at a time all is fine.
Thanks again,
Rick
[email protected]
www.i4i.com
-
July 11th, 2001, 01:42 PM
#5
Re: Error applying textbox to event ClassModule
Hey John,
Thanks for responding... I found my problem and though that you might be interested.
One thing I did not mention was that I have 128 textboxs and they were in a textbox collection. I just figured out that you cannot pass a textbox from an array (collection) to an event class if I add the textboxs one at a time all is fine.
Thanks again,
Rick
[email protected]
www.i4i.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|