473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

From JScript to C# (COM)


I'm looking for C# examples when calling COM objects. JScript example:

var myApp = new ActiveXObject("MyApp.1");
var res = myApp.callMethod1();

I have tried to use Google with keywords "C# COM" but it finds "COM" in
every "somewebsite.com" string. :(
Nov 17 '05 #1
3 1142
Petar,

Using COM objects in C# is a little different than Javascript. You will
need to create an interop library, and then reference it. Once you do that,
you can call it like any other object in .NET.

If you are using VS.NET, then open up the references folder in your
project, and select "Add Reference". On the dialog that comes up, select
the "COM" tab, and select the dll that has the classes you want to use. At
that point, you should have access to the classes that are in the dll.

If you are not using VS.NET then you can use the TLBIMP tool to create
an interop assembly, and then use the classes in the same way.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Petar Popara" <my*****@mail.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

I'm looking for C# examples when calling COM objects. JScript example:

var myApp = new ActiveXObject("MyApp.1");
var res = myApp.callMethod1();

I have tried to use Google with keywords "C# COM" but it finds "COM" in
every "somewebsite.com" string. :(

Nov 17 '05 #2

Thank you very much. I did as you said, but don't know how to continue.
Could you please translate this in C# for me:
var myApp = new ActiveXObject("MyApp.1");
var res = myApp.callMethod1();


I have never used C# before. I just want to make few C# usage examples for
my COM object.
Nov 17 '05 #3

Forget it. I have figure it out how it works. :)
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Christopher Brandsdal | last post by:
I have this string: /sites/binaer/demo/fil/Winnie-the-Pooh 1024x768.jpg If I wanted to cut everything before Winnie-the-Pooh 1024x768.jpg, how would I do this? In VBScript I could find the...
5
by: benc | last post by:
Hi Can some good soul help on this. I need to call jscript functions from C#. I have hosted a web control and displayed an html page successfully, but just can't find a way to call jscript...
2
by: moondaddy | last post by:
I'm using vb.net and have an aspx page where I want to call a function in the code behind to do something on the backend and I want to call this function from a jscript function in the aspx page. ...
1
by: Adrian | last post by:
I appear to be losing ViewState information when calling the __doPostBack function. I am attempting to use the showModalDialog to load a new web page which confirms that a user wishes to save a...
7
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with...
7
by: David Schwartz | last post by:
Does anyone know how I can call a function in a VB.NET DLL from Java script code? Thanks.
5
by: Maxwell2006 | last post by:
Hi, I have a requirement to develop an application component using only Server-Side Jscript (not Jscript.NET). What is Server-Side Jscript?
62
by: ivan.leben | last post by:
How can I really delete a preloaded image from memory/disk cache? Let's say I preload an image by creating an Image object and setting its src attribute to desired URL: var img = new Image();...
3
by: bowser | last post by:
Hello, I have a problem of communication between JScript and C#. I must say that I'm new to both. In a JS file I have to call a C# function. In particular I have: public function Eval(expr :...
1
by: andrewwan1980 | last post by:
How can VBScript code access JScript code variables in the same ASP page? <SCRIPT LANGAUGE="VBScript"> Dim a a = 10 </SCRIPT> <SCRIPT LANGUAGE="JScript"> Response.Write(a); </SCRIPT>
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.