Hallo,
ich steige gerade von VB6 auf VB2005 um, und prompt ist ein Problem aufgetaucht.
Der Beispielcode läuft problemlos auf VB6, auf VB2005 bekomme ich die Fehlermeldung 'Methode nicht implementiert'.
Wenn alle Variablen als Object deklariert sind läuft es, wenn alle typgerecht dekl. sind läuft es, wenn 'gemixt' wird läuft es nicht!
Was ich auch nicht verstehe (gilt für VB6 und VB2005):
Alle Variablen als Object --> TypeName OK
Alle Variablen typisiert --> TypeName gibt manchmal nur Object zurück
Hintergrund:
Ich möchte in einer Schleife mit 'TypeName' filtern, aber trotzdem Intellisense verwenden.
Hat jemand 'ne Erklärung oder 'ne Idee?
Gruß
CAMiCADse
Code:
Imports ProductStructureTypeLib
....
Dim CATIA As Object
CATIA = GetObject(, "CATIA.Application") Dim MyProdDoc As ProductDocument
Dim MyRootProd 'As Product'<-- Als Product dekl. = Fehler weg
Dim MyProds As Products
Dim MySubProd As Product
MyProdDoc = CATIA.ActiveDocument
Debug.Print("MyProdDoc = " & TypeName(MyProdDoc))
MyRootProd = MyProdDoc.Product
Debug.Print("MyRootProd = " & TypeName(MyRootProd))
MyProds = MyRootProd.Products
Debug.Print("MyProds = " & TypeName(MyProds))
'V1
MySubProd = MyProds.Item(1)
Debug.Print("MySubProd V1= " & TypeName(MySubProd))
'V2
MySubProd = CATIA.Activedocument.Product.Products.item(1)
Debug.Print("MySubProd V2= " & TypeName(MySubProd))
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP