Retrieve from Collection, Interop issue

kindejj

New member
Joined
Jul 11, 2005
Messages
2
Programming Experience
10+
Retrieve from Collection, Interop issue (Resolved)

I have a collection class that is in an interop .NET library. It's inside an ADO wrapper library and is used for the stored procedure parameters. Everything works wonderfully except that in my vb6 application I cannot get the (!) operator to work. I get an Object doesn't support this property or method error. Does anyone know of a solution to this problem? Maybe I need to add something to the interface of my .NET library?

A solution is very important because this is an enterprise application containing several million lines of code, I don't even want to think about not being able to find a solution.

Old vb6 way (goADO is my ADOc wrapper).

VB.NET:
Dim loSpParms as mySpParms '<--Collection class
dim lsName as String
 
'Instantiate collection class
Set loSpParms = New mySpParms
With loSpParms
	 'Add an input parameter to the collection
	 .Add "ClientId", glClientId
 
	 'Call into the ADO wrapper, it will use the collection class to get the input
	 'parameters and then will also add the stored procedure output 
	 'parameters to the collection.
	 Call goADO.ExecSql("s_tbClientSEL_GetName", loSpParms)
 
	 'An output parameter is called Name, get it.
	 lsName = !Name.Value	'<--This code does not work! It's the ! operator
End With
 
'Note, everything works if I use the following code, but I don't want to 
'change it in 1/2 million places in our code.
lsName = loSpParms.Item("Name").Value

I know this is pretty generic, so if you need further info just ask.

Thanks!
 
Last edited:
Well, my boss figured it out. Glad I didn't bet him who'd figure it out first.

To make the bang operator (!) work inside a VB6 project using an interop .NET library you have to give your default properties a DispId of 0. Do that and you're good to go.
 
Back
Top