InvalidActiveXStateException

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I have been banging my head on this one for a while. I have a VB6 ActiveX
control wrapped inside a C# 2003 Forms Control.

When I use this C# control in a standalone windows form application, the
ActiveX control works correctly. However, if I try to use it inside a VBA
(Excel) form by dynamically adding it, I always get an
InvalidActiveXStateException.

Looking up the error, I get the ever-so-helpful description of "The
exception that is thrown when the ActiveX control is referenced while in an
invalid state." Oh, really?

I have been scouring the 'Net for any workarounds or explanations, but
haven't found anything that works.

This started as an annoyance, and now it's a personal obsession....

I'd really appreciate any help or pointers.

Thanks,
pagates
 
pagates,

You realize that .NET doesn't support hosting controls in ActiveX
containers, right? It only goes one way, from ActiveX -> .NET, not the
reverse.

Hope this helps.
 
Hi Nick--

Nicholas Paldino said:
You realize that .NET doesn't support hosting controls in ActiveX
containers, right? It only goes one way, from ActiveX -> .NET, not the
reverse.

Yes, but try to explain that to a project manager... : )

Actually, I am able to use .NET controls inside VB or VBA, but the problem
occurs when "double-converting" ActiveX -> .NET -> ActiveX

Thanks,
Paul
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

pagates said:
Hi All,

I have been banging my head on this one for a while. I have a VB6 ActiveX
control wrapped inside a C# 2003 Forms Control.

When I use this C# control in a standalone windows form application, the
ActiveX control works correctly. However, if I try to use it inside a VBA
(Excel) form by dynamically adding it, I always get an
InvalidActiveXStateException.

Looking up the error, I get the ever-so-helpful description of "The
exception that is thrown when the ActiveX control is referenced while in
an
invalid state." Oh, really?

I have been scouring the 'Net for any workarounds or explanations, but
haven't found anything that works.

This started as an annoyance, and now it's a personal obsession....

I'd really appreciate any help or pointers.

Thanks,
pagates
 
pagates,

It's not even explaining it to a project manager. You have to
understand that what you are doing is completely unsupported, and by being
the guy who will have to support it later, you are asking for a world of
hurt when something breaks/changes in a way that can't be fixed, because it
was never supported in the first place.

Of course, the easier solution would be to just host the ActiveX control
directly. Why do you have to host a .NET wrapper around an ActiveX control
in an ActiveX container? Why not just figure out what is an ActiveX control
and what is not and host it the correct way?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

pagates said:
Hi Nick--

Nicholas Paldino said:
You realize that .NET doesn't support hosting controls in ActiveX
containers, right? It only goes one way, from ActiveX -> .NET, not the
reverse.

Yes, but try to explain that to a project manager... : )

Actually, I am able to use .NET controls inside VB or VBA, but the problem
occurs when "double-converting" ActiveX -> .NET -> ActiveX

Thanks,
Paul
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

pagates said:
Hi All,

I have been banging my head on this one for a while. I have a VB6
ActiveX
control wrapped inside a C# 2003 Forms Control.

When I use this C# control in a standalone windows form application,
the
ActiveX control works correctly. However, if I try to use it inside a
VBA
(Excel) form by dynamically adding it, I always get an
InvalidActiveXStateException.

Looking up the error, I get the ever-so-helpful description of "The
exception that is thrown when the ActiveX control is referenced while
in
an
invalid state." Oh, really?

I have been scouring the 'Net for any workarounds or explanations, but
haven't found anything that works.

This started as an annoyance, and now it's a personal obsession....

I'd really appreciate any help or pointers.

Thanks,
pagates
 
Hi Nicholas,

I agree. It's one of those things that was designed and implemented, and
then somebody said "hey - that would work great in our Excel Add-In!".

My workaround isn't elegant, but I have a property that hides the view that
contains the ActiveX control when called from VB/VBA.

Oh, well. Still wish that they had completed (and supported) the .NET ->
ActiveX implementation to better support legecy (whoops, I used the L-word)
products, but that's a philosophical debate for another day....

Thanks,
Paul

Nicholas Paldino said:
pagates,

It's not even explaining it to a project manager. You have to
understand that what you are doing is completely unsupported, and by being
the guy who will have to support it later, you are asking for a world of
hurt when something breaks/changes in a way that can't be fixed, because it
was never supported in the first place.

Of course, the easier solution would be to just host the ActiveX control
directly. Why do you have to host a .NET wrapper around an ActiveX control
in an ActiveX container? Why not just figure out what is an ActiveX control
and what is not and host it the correct way?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

pagates said:
Hi Nick--

Nicholas Paldino said:
You realize that .NET doesn't support hosting controls in ActiveX
containers, right? It only goes one way, from ActiveX -> .NET, not the
reverse.

Yes, but try to explain that to a project manager... : )

Actually, I am able to use .NET controls inside VB or VBA, but the problem
occurs when "double-converting" ActiveX -> .NET -> ActiveX

Thanks,
Paul
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi All,

I have been banging my head on this one for a while. I have a VB6
ActiveX
control wrapped inside a C# 2003 Forms Control.

When I use this C# control in a standalone windows form application,
the
ActiveX control works correctly. However, if I try to use it inside a
VBA
(Excel) form by dynamically adding it, I always get an
InvalidActiveXStateException.

Looking up the error, I get the ever-so-helpful description of "The
exception that is thrown when the ActiveX control is referenced while
in
an
invalid state." Oh, really?

I have been scouring the 'Net for any workarounds or explanations, but
haven't found anything that works.

This started as an annoyance, and now it's a personal obsession....

I'd really appreciate any help or pointers.

Thanks,
pagates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top