By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,414 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,414 IT Pros & Developers. It's quick & easy.

How to overcome from the error : "Object does not match target typ

P: n/a
hi,

Im running this code
public Boolean IsLayoutOpen(String strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation.Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(strLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetation.Layouts (it is From COM object) it gives me exception "Object
does not match target type."

Can someone tell me why this error is coming & what is the solution to
resolve this problem.
Jul 4 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Swappy wrote:
hi,

Im running this code
No, you are not running that code. It won't even compile, as you don't
set any return value in the method.

It might not be possible to say what's wrong with the code that you are
running, as you are some other code that you are not running.
public Boolean IsLayoutOpen(String strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation.Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(strLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetation.Layouts (it is From COM object) it gives me exception "Object
does not match target type."

Can someone tell me why this error is coming & what is the solution to
resolve this problem.
What more information does the exception contain? For example, what is
the type of the exception? That would help to determine if the exception
occurs in the COM method or in the code that is calling the COM method.

How is the method declared in the COM code?

--
Göran Andersson
_____
http://www.guffa.com
Jul 4 '08 #2

P: n/a


"Göran Andersson" wrote:
Swappy wrote:
hi,

Im running this code

No, you are not running that code. It won't even compile, as you don't
set any return value in the method.

It might not be possible to say what's wrong with the code that you are
running, as you are some other code that you are not running.
public Boolean IsLayoutOpen(String strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation.Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(strLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetation.Layouts (it is From COM object) it gives me exception "Object
does not match target type."

Can someone tell me why this error is coming & what is the solution to
resolve this problem.

What more information does the exception contain? For example, what is
the type of the exception? That would help to determine if the exception
occurs in the COM method or in the code that is calling the COM method.

How is the method declared in the COM code?

--
Göran Andersson
_____
http://www.guffa.com
Hi ,
That exception contain the following information :
Source : "mscorlib"
Data : System.CollectionaryInternal
HelpLink : null
InnerException : null
StackTrace : at System.RuntimeType.InvokeDispMethod(String name,........)
TargetSite : System.ObjectInvokeDispMethod(System.string,
System.Reflection.BindingFlags,........)
Jul 4 '08 #3

P: n/a
Swappy wrote:
>
"Göran Andersson" wrote:
>Swappy wrote:
>>hi,

Im running this code
No, you are not running that code. It won't even compile, as you don't
set any return value in the method.

It might not be possible to say what's wrong with the code that you are
running, as you are some other code that you are not running.
>>public Boolean IsLayoutOpen(String strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation.Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(strLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetation.Layouts (it is From COM object) it gives me exception "Object
does not match target type."

Can someone tell me why this error is coming & what is the solution to
resolve this problem.
What more information does the exception contain? For example, what is
the type of the exception? That would help to determine if the exception
occurs in the COM method or in the code that is calling the COM method.

How is the method declared in the COM code?

--
Göran Andersson
_____
http://www.guffa.com

Hi ,
That exception contain the following information :
Source : "mscorlib"
Data : System.CollectionaryInternal
HelpLink : null
InnerException : null
StackTrace : at System.RuntimeType.InvokeDispMethod(String name,........)
TargetSite : System.ObjectInvokeDispMethod(System.string,
System.Reflection.BindingFlags,........)
It looks like the COM method is declared as returning a Layouts object
(as the code compiles), but it's actually returning something different.

--
Göran Andersson
_____
http://www.guffa.com
Jul 4 '08 #4

P: n/a


"Göran Andersson" wrote:
Swappy wrote:

"Göran Andersson" wrote:
Swappy wrote:
hi,

Im running this code
No, you are not running that code. It won't even compile, as you don't
set any return value in the method.

It might not be possible to say what's wrong with the code that you are
running, as you are some other code that you are not running.

public Boolean IsLayoutOpen(String strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation.Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(strLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetation.Layouts (it is From COM object) it gives me exception "Object
does not match target type."

Can someone tell me why this error is coming & what is the solution to
resolve this problem.
What more information does the exception contain? For example, what is
the type of the exception? That would help to determine if the exception
occurs in the COM method or in the code that is calling the COM method.

How is the method declared in the COM code?

--
Göran Andersson
_____
http://www.guffa.com
Hi ,
That exception contain the following information :
Source : "mscorlib"
Data : System.CollectionaryInternal
HelpLink : null
InnerException : null
StackTrace : at System.RuntimeType.InvokeDispMethod(String name,........)
TargetSite : System.ObjectInvokeDispMethod(System.string,
System.Reflection.BindingFlags,........)

It looks like the COM method is declared as returning a Layouts object
(as the code compiles), but it's actually returning something different.

--
Göran Andersson
_____
http://www.guffa.com

Ya, i think this method is returning something different but why this is
happening?
Is this because of this method i m calling inside the thread?

The same code when i run without the thread then it runs properly & returns
the Layouts.

If this is because of thread then how can i overcome this problem. Please
suggest me any solution.
Jul 7 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.