473,320 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

InvalidActiveXStateException

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
May 4 '06 #1
4 6619
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
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

May 4 '06 #2
Hi Nick--

"Nicholas Paldino [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
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


May 4 '06 #3
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]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.com...
Hi Nick--

"Nicholas Paldino [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
> 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


May 4 '06 #4
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 [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:87**********************************@microsof t.com...
Hi Nick--

"Nicholas Paldino [.NET/C# MVP]" wrote:
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]
- mv*@spam.guard.caspershouse.com

"pagates" <pa*****@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
> 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


May 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Greg Grosiak | last post by:
Hello, I am tring to load a ms agent file and getting the Error "InvalidActiveXStateException" and can not find a reference to it in the knowledgebase. Can someone help ? Ex. ...
1
by: pagates | last post by:
Hello, I am writing a control in C# that requires me to use an ActiveX control created in VB6. It works fine running from inside the IDE in both debug and release mode. However, when I try...
2
by: Mehr H | last post by:
I have been working on this for several days and am still have had no success in achieving this. Pleae help. It seems that documentation for this is very limited. I have looked in several books and...
1
by: Mehr H | last post by:
I have been working on this for several days and am still have had no success in achieving this. Pleae help. It seems that documentation for this is very limited. I have looked in several books and...
0
by: vbcrazy | last post by:
Hello, I have included the wmp v9 in my vb.net project. Everytime I display the designer it writes a command to enable the wmp in the System.Diagnostics.DebuggerStepThrough space. Then when I...
0
by: Evan Delodder | last post by:
I am trying to edit form elements (labels, text box's, etc) in Visual Studio.NET using VB.NET. Whenever I edit certain forms’ appearance whether it is through the code, or through the designer, I...
0
by: gipsycall | last post by:
Hi, trying to integrate the activeXControl in a c#- application, which builds forms dynamically. Actually I don't even know which properties I've to set to reach a valid controlstate- everytime...
0
by: Patel | last post by:
Hi All, I am doing one INTERESTING work with Context Menu Strip. I am trying to insert a custom control / .Net control in Context menu as a context menu strip. I tried inserting MonthCalender in...
0
by: Patel | last post by:
Hi All, I am doing one INTERESTING work with Context Menu Strip. I am trying to insert a custom control / .Net control in Context menu as a context menu strip. I tried inserting MonthCalender in...
0
tlhintoq
by: tlhintoq | last post by:
My project involves reading magstripe cards, capturing an ID number, then spinning off to do some other things including taking a photograph. 99% of this is done and good. All early phases of work...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.