Results 1 to 4 of 4

Thread: COM Objects and .NET

  1. #1

    Thread Starter
    Registered User
    Join Date
    Mar 2002
    Location
    Nashville, TN
    Posts
    103

    Exclamation COM Objects and .NET

    I have come across a VERY strange problem in .NET. I am in the process of rebuilding an app in .NET that was originally constructed in VB 6.0. It uses a couple of COM Objects for a Dialer program we purchased. In VB 6, the method calls to one of the objects in the COM object requires an object reference for a parameter (it's actually another object from the COM library). However, for some reason, .NET is interpretting this parameter as a string instead of an object so it gives me an error saying it can't convert an object to string. Does anybody have ANY idea how to fix this?

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Im guessing that you added a reference to the COM object and it automatically added an interop file (check under references). You can open these with a program called ILDASM. Im not any kind of expert but you should be able to use this and the search facility (MSDN) to work out how to create a new interop file with your settings.

    I have just added my own com objects and they work fine (well kinda). I created a module with

    Option Strict Off

    added and created my own funcitons something like this

    Function funcPassComObject(COMThing as Object, ComParamater as Object)
    Try
    COMThing.DoSomeThing(ComParamater);
    Catch
    End Try
    End Function


    Good luck !

  3. #3

    Thread Starter
    Registered User
    Join Date
    Mar 2002
    Location
    Nashville, TN
    Posts
    103
    Ok, I found the ILDASM and used it to open the Interop file. I've looked through the help on MSDN though and can't seem to find anything that is going to help me fix my problem? I can't use the ILDASM to edit the properties of the various methods I need to change. Do I have to completely reconnstruct the COM Library for this file? If so, how do I use the ILDASM to accomplish this?

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    As I said, im no expert. After looking around a bit I found out that
    you can use ILDASM to extract the IL code, then use another program MSIL Assembler (Ilasm.exe) to re-create the .exe after.

    Hope that helps, I just heard about it on a MS course I went on last year but have never had to use it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width