473,770 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
+ 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(St ring strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation .Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(st rLayoutName);

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 2445
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(St ring strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation .Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(st rLayoutName);

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(St ring strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation .Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(st rLayoutName);

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.Collecti onaryInternal
HelpLink : null
InnerException : null
StackTrace : at System.RuntimeT ype.InvokeDispM ethod(String name,........)
TargetSite : System.ObjectIn vokeDispMethod( System.string,
System.Reflecti on.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(St ring strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation .Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(st rLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetati on.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.Collecti onaryInternal
HelpLink : null
InnerException : null
StackTrace : at System.RuntimeT ype.InvokeDispM ethod(String name,........)
TargetSite : System.ObjectIn vokeDispMethod( System.string,
System.Reflecti on.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(St ring strLayoutName)
{
Layout Layout_Obj = null;
try
{
Layouts layouts = instrumentation .Layouts; //This call is
through COM object
Layout_Obj = layouts.Item(st rLayoutName);

layouts = null;
}
}

This code i am running in a thread but while calling the
instrumnetatio n.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.Collecti onaryInternal
HelpLink : null
InnerException : null
StackTrace : at System.RuntimeT ype.InvokeDispM ethod(String name,........)
TargetSite : System.ObjectIn vokeDispMethod( System.string,
System.Reflecti on.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
47630
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 at the <BODY> Tag of my code so I'm thinking the problem is with my InitPage() function. I appreciate the advice. Here is my code. <SCRIPT LANGUAGE="Javascript"> <!-- var flag = false;
18
28758
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, FontStyle.Bold), Brushes.Black, 0, 0) Why is this? Marc
0
2088
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 time in the properties section of VS, I get the error "object reference not set to instance of an object" and the only option is to click OK. I have not yet tried to set that datasource at runtime, but of course I could do that. But I don't...
1
9483
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:- onclick="retrieveURL('/application/home_page.do?processAction=ItinerarySearch','AfoHomeForm')" after clicking on button i am getting following error:- object does not support this property or method at statement (Which i have made it bold in js file)
4
3097
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 System.EventArgs) Handles Button1.Click Hiddenfield1.value="end text" end sub
2
6501
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 class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005". so I configured the server using dcomcnfg as described in this link: http://support.microsoft.com/kb/288368/ and know...
5
2871
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. var oShell = new ActiveXObject("Shell32.Application");
10
13323
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." "Line:xxx" "Error: Object expected" and Debug says: "Microsoft JScript runtime error: Object expected."
2
3976
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 of DLL. i.e Method of file A -Method of file B -Method of DLL. But in the file B's method while calling DLL's method it is giving me Error "Object does not match target type.".
5
3834
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 need help from senors please explain me about it and also indicate it in my code. Here is my code in my Class Named DBHandler!!! using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data.SqlClient;...
0
9453
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6710
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.