Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2005, 12:48 PM
Authorized User
 
Join Date: Jun 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default InvalidActiveXStateException

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 to run an installed version, I get an InvalidActiveXStateException whenever I try to access a method or property of the ActiveX control. For instance, there is a connection property that is defined in the ActiveX control as:

Code:
Public Function Connect(Hostname As String, Port As Long, _
    Flags As Integer, UserName As String, _
    Password As String) As Integer


Inside the C# code, I call it like this:
Code:
    try
    {
        Result = axMyControl.Connect(ref m_HostName, 
        ref m_Port, ref Flags, ref m_UserName, ref m_Password);
    }
    catch (Exception e)
    {
    MessageBox.Show("Unable to connect to " + m_HostName + 
        "\n" + e.Message, "Connection Error",
            MessageBoxButtons.OK, MessageBoxIcon.Information);
    return;
    }


The exception is always thrown here (and anywhere else I try to access the code).

Any suggestions?

Thanks,
pagates









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.