locked
Casting IDispatch RRS feed

  • Question

  • Hi,

    I have a VB form which has the following property :

    Public Property Get MySplit() As Object
       Set MySplit = ToolMeGet
    End Property
    
    
    I did the following
    1. Created a ActiveX EXE of this program
    2. Used tlbimp to create an interop
    3. Add reference to this Interop in my C# project

    This returns to me a metadata in my C# program as

    namespace MyWindow
     {
         [TypeLibType(4304)]
         [Guid("EFA04E78-DB7E-4D40-9963-584A2D08A97E")]
         public interface _Window
         {
             [DispId(1745027080)]
             object Form { get; set; }
         }
    }
    I am getting the Form itself as an object and am running wild to access the properties of this form. I am sure it is doing late binding because I am able to get the vb form name using the code below:

    MessageBox.Show(Microsoft.VisualBasic.Information.TypeName(objValue));
    My problem is to get the correct type of the form and ultimately get the VB properties MySplit() accessable.

    Help.
    Thursday, April 9, 2009 10:47 AM