dcparizo

dcparizo

  • NA
  • 1
  • 0

accessing/casting a generic vb object type

Feb 10 2005 11:53 AM
I've got a problem where by I'm attemping some integration with an older application. That application (and documentation) is written in vb with a type lib provided. The documentation states that all of the objects are created in vb as a type of "object" and subsequently methods for each subclass/superclass (depending on your point of view) are available. My problem is that I can create the application object. The application object has a method for Open Project which returns a generic vb object that is actually a project type. When ever I attempt to cast, assign, re-assign or subsequently do anything with the return value to change (or initially assign) it to the actual project type, I get one of two errors. 1) that I cannot implicitly cast an object type to a project type 2) that I cannot cast one managed type to another. 3) when I can do the cast from a coding stand point, I get a runtime exception thrown for attemping an invalid cast. I've also tried to convert the .tlb to a .net tlb via the tblimp utility. Same results. ps. I've tried using both safe and unsafe code types. Any help here would be great.