473,473 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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
4 2422
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


"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
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


"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Danny | last post by:
Hi I don't understand why I keep getting "Error: Object expected" I tried different things and haven't been able to solve it. I'm a newbie so I'm not sure what I'm doing wrong. The debugger breaks...
18
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12,...
0
by: Martin Widmer | last post by:
Hello again! I have a datagridview control on my form and am using VS.Net 2005. One column is set up as combo box column, and when I try to set the datasource for that combobox column at design...
1
by: kamleshsharmadts | last post by:
I am using Ajax with struts in web application. from jsp i am calling a function of ajax.js onclick of a button. code of that call function which calling from jsp given as below:- ...
4
by: Phil | last post by:
Hi, This code gives an javascript error: "Object required" and never let see the Alert window. in code-behind: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As...
2
by: =?Utf-8?B?QmFkaXM=?= | last post by:
I'm doing a server side automation(I know it's bad but..) and its working fine locally and when accessing it from a remote machine using web browser is was giving me this error"Retrieving the COM...
5
by: Diego Ruiz | last post by:
Hi!! my english is not too good, but i'll try it I have a javascript code: function executeCommands(inputparms) { // Instantiate the Shell object and invoke its execute method. ...
10
RMWChaos
by: RMWChaos | last post by:
WinVista/IE7 I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is: "A Runtime Error has occurred."...
2
by: =?Utf-8?B?U3dhcHB5?= | last post by:
hi, I am working on application in this i am using two files. In first (consider A) file i am calling the function of other file (consider B). In that function of file B i am calling the method...
5
by: dotnetnovice | last post by:
Hi everybody actually i was trying to insert some records in to SQL server through C# Wndows Aplication and during that i face an error "Object reference not set to an instance of an object." and...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.