AxHost.InvalidActiveXStateException AxHost.InvalidActiveXStateException AxHost.InvalidActiveXStateException AxHost.InvalidActiveXStateException Constructors

Definition

Overloads

AxHost.InvalidActiveXStateException() AxHost.InvalidActiveXStateException() AxHost.InvalidActiveXStateException()

Initializes a new instance of the AxHost.InvalidActiveXStateException class without specifying information about the member that referenced the ActiveX control.

AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind) AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind) AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind) AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind)

Initializes a new instance of the AxHost.InvalidActiveXStateException class and indicates the name of the member that referenced the ActiveX control and the kind of reference it made.

AxHost.InvalidActiveXStateException() AxHost.InvalidActiveXStateException() AxHost.InvalidActiveXStateException()

Initializes a new instance of the AxHost.InvalidActiveXStateException class without specifying information about the member that referenced the ActiveX control.

public:
 InvalidActiveXStateException();
public InvalidActiveXStateException ();
Public Sub New ()

AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind) AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind) AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind) AxHost.InvalidActiveXStateException(String, AxHost+ActiveXInvokeKind)

Initializes a new instance of the AxHost.InvalidActiveXStateException class and indicates the name of the member that referenced the ActiveX control and the kind of reference it made.

public:
 InvalidActiveXStateException(System::String ^ name, System::Windows::Forms::AxHost::ActiveXInvokeKind kind);
public InvalidActiveXStateException (string name, System.Windows.Forms.AxHost.ActiveXInvokeKind kind);
new System.Windows.Forms.AxHost.InvalidActiveXStateException : string * System.Windows.Forms.AxHost.ActiveXInvokeKind -> System.Windows.Forms.AxHost.InvalidActiveXStateException
Public Sub New (name As String, kind As AxHost.ActiveXInvokeKind)

Parameters

name
String String String String

The name of the member that referenced the ActiveX control while it was in an invalid state.

Examples

The following code example overrides the constructor, and the SetAboutBoxDelegate and AttachInterfaces methods of an AxHost derived class that wraps the Microsoft Masked Edit ActiveX Control. This code requires that you have created the generated source code by running the AxImp.exe on the MSMask32.ocx file with the /source switch to generate the wrapper class to be edited. This code is only shown in C# syntax because that is the only language output by the AxImp.exe.

public AxMaskEdBox()
    :
  base("c932ba85-4374-101b-a56c-00aa003668dc") // The ActiveX control's class identifier.
{
    // Make the AboutBox method the about box delegate.
    this.SetAboutBoxDelegate(new AboutBoxDelegate(AboutBox));
}

public virtual void AboutBox()
{
    // If the instance of the ActiveX control is null when the AboutBox method 
    // is called, raise an InvalidActiveXStateException exception.
    if ((this.ocx == null))
    {
        throw new System.Windows.Forms.AxHost.InvalidActiveXStateException(
          "AboutBox", System.Windows.Forms.AxHost.ActiveXInvokeKind.MethodInvoke);
    }
    // Show the about box if the ActiveX control has one.
    if (this.HasAboutBox)
    {
        this.ocx.AboutBox();
    }
}

protected override void AttachInterfaces()
{
    try
    {
        // Attach the IMSMask interface to the ActiveX control.
        this.ocx = ((MSMask.IMSMask)(this.GetOcx()));
    }
    catch (System.Exception ex)
    {
        System.Console.WriteLine(ex.Message);
    }
}
See also

Applies to