How to use an Active-X control...

  • Thread starter Thread starter Zeke
  • Start date Start date
Z

Zeke

(VS 2005 Prof)
Please give me some help on how to use an activeX control. I have done the
following:
- created a dll with one class (Utils) which has functions
- imported the ActiveX with tlbimp <dll-path> /out:<cs_dll-path
- added a reference to the new cs dll (Projects, Add reference)
- added a "using" line to the dll.

I can see in intellisense that it is "working". I can also call the unction
which takes no parameters:
Utils ox = new Utils();
string cTest = ox.test();
The string cTest gets the proper value from the ActiveX control

When I try to use a function which takes one parameter I get the following
error:
"No overload method "method_name" which takes '1' arguments

Can you tell me what's lacking - obviuosly there's some difference in how to
use ActiveX functions which takes parameters and which don't.

Any help would be appreciated.
 
Zeke,

Is there an interface definition that you can use? Something like
_Utils or IUtils? If so, create a variable of that type and then cast "ox"
to that variable. It should expose the methods you are looking for.

Hope this helps.
 
I tried that, but the result is the same. "No overload method .... takes '1'
argument. It seems that the parameters in the ActiveX control is not
visible - because it works if I call it without parameters. I have tested
the ActiveX in VB6 and there it works fine. Can't figure out what is
missing...


Nicholas Paldino said:
Zeke,

Is there an interface definition that you can use? Something like
_Utils or IUtils? If so, create a variable of that type and then cast
"ox" to that variable. It should expose the methods you are looking for.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Zeke said:
(VS 2005 Prof)
Please give me some help on how to use an activeX control. I have done
the following:
- created a dll with one class (Utils) which has functions
- imported the ActiveX with tlbimp <dll-path> /out:<cs_dll-path
- added a reference to the new cs dll (Projects, Add reference)
- added a "using" line to the dll.

I can see in intellisense that it is "working". I can also call the
unction which takes no parameters:
Utils ox = new Utils();
string cTest = ox.test();
The string cTest gets the proper value from the ActiveX control

When I try to use a function which takes one parameter I get the
following error:
"No overload method "method_name" which takes '1' arguments

Can you tell me what's lacking - obviuosly there's some difference in how
to use ActiveX functions which takes parameters and which don't.

Any help would be appreciated.
 
Zeke,

Can you show the class/interface definition, as well as how you are
calling it? Maybe even post the interop assembly and the code you are using
to call it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Zeke said:
I tried that, but the result is the same. "No overload method .... takes
'1' argument. It seems that the parameters in the ActiveX control is not
visible - because it works if I call it without parameters. I have tested
the ActiveX in VB6 and there it works fine. Can't figure out what is
missing...


Nicholas Paldino said:
Zeke,

Is there an interface definition that you can use? Something like
_Utils or IUtils? If so, create a variable of that type and then cast
"ox" to that variable. It should expose the methods you are looking for.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Zeke said:
(VS 2005 Prof)
Please give me some help on how to use an activeX control. I have done
the following:
- created a dll with one class (Utils) which has functions
- imported the ActiveX with tlbimp <dll-path> /out:<cs_dll-path
- added a reference to the new cs dll (Projects, Add reference)
- added a "using" line to the dll.

I can see in intellisense that it is "working". I can also call the
unction which takes no parameters:
Utils ox = new Utils();
string cTest = ox.test();
The string cTest gets the proper value from the ActiveX control

When I try to use a function which takes one parameter I get the
following error:
"No overload method "method_name" which takes '1' arguments

Can you tell me what's lacking - obviuosly there's some difference in
how to use ActiveX functions which takes parameters and which don't.

Any help would be appreciated.
 
Got it! I imported the dll again and the parameters showed up this time.
Probably some update problem.
Thanks.
Zeke

Nicholas Paldino said:
Zeke,

Can you show the class/interface definition, as well as how you are
calling it? Maybe even post the interop assembly and the code you are
using to call it?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Zeke said:
I tried that, but the result is the same. "No overload method .... takes
'1' argument. It seems that the parameters in the ActiveX control is not
visible - because it works if I call it without parameters. I have tested
the ActiveX in VB6 and there it works fine. Can't figure out what is
missing...


Nicholas Paldino said:
Zeke,

Is there an interface definition that you can use? Something like
_Utils or IUtils? If so, create a variable of that type and then cast
"ox" to that variable. It should expose the methods you are looking
for.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

(VS 2005 Prof)
Please give me some help on how to use an activeX control. I have done
the following:
- created a dll with one class (Utils) which has functions
- imported the ActiveX with tlbimp <dll-path> /out:<cs_dll-path
- added a reference to the new cs dll (Projects, Add reference)
- added a "using" line to the dll.

I can see in intellisense that it is "working". I can also call the
unction which takes no parameters:
Utils ox = new Utils();
string cTest = ox.test();
The string cTest gets the proper value from the ActiveX control

When I try to use a function which takes one parameter I get the
following error:
"No overload method "method_name" which takes '1' arguments

Can you tell me what's lacking - obviuosly there's some difference in
how to use ActiveX functions which takes parameters and which don't.

Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top