473,624 Members | 2,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# and vbscript

Hello Everyone,

I am trying to access a C# class from vbscript. All is file, except for the
case when I want to use optional parameters or function overloading. As I
found out, optional parameters are not supported by C#, function overloading
is not supported by COM. There is an attribute:

[System.Runtime. InteropServices .OptionalAttrib ute]

that does not seem to work, I still have to fill the parameter in vbscript,
otherwise the following exception is thrown:

- $exception {System.Runtime .InteropService s.COMException}
System.Runtime. InteropServices .COMException
+ System.SystemEx ception {"Type mismatch: 'getPC'"} System.SystemEx ception
ErrorCode -2146828275 int

Is there anyone who was able to solve this problem?

Thank you & regards,
Jozsef
Nov 17 '05 #1
2 3683
For reference, I got an answer for this question in the interopservices
newsgroup.

For using
[System.Runtime. InteropServices .OptionalAttrib ute]
the parameter type has to be object.

"Jozsef Bekes" <bj****@hotmail .com> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
Hello Everyone,

I am trying to access a C# class from vbscript. All is file, except for
the case when I want to use optional parameters or function overloading.
As I found out, optional parameters are not supported by C#, function
overloading is not supported by COM. There is an attribute:

[System.Runtime. InteropServices .OptionalAttrib ute]

that does not seem to work, I still have to fill the parameter in
vbscript, otherwise the following exception is thrown:

- $exception {System.Runtime .InteropService s.COMException}
System.Runtime. InteropServices .COMException
+ System.SystemEx ception {"Type mismatch: 'getPC'"} System.SystemEx ception
ErrorCode -2146828275 int

Is there anyone who was able to solve this problem?

Thank you & regards,
Jozsef

Nov 17 '05 #2
For reference, I got an answer for this question in the interopservices
newsgroup.

For using
[System.Runtime. InteropServices .OptionalAttrib ute]
the parameter type has to be object.

"Jozsef Bekes" <bj****@hotmail .com> wrote in message
news:eu******** ******@TK2MSFTN GP12.phx.gbl...
Hello Everyone,

I am trying to access a C# class from vbscript. All is file, except for
the case when I want to use optional parameters or function overloading.
As I found out, optional parameters are not supported by C#, function
overloading is not supported by COM. There is an attribute:

[System.Runtime. InteropServices .OptionalAttrib ute]

that does not seem to work, I still have to fill the parameter in
vbscript, otherwise the following exception is thrown:

- $exception {System.Runtime .InteropService s.COMException}
System.Runtime. InteropServices .COMException
+ System.SystemEx ception {"Type mismatch: 'getPC'"} System.SystemEx ception
ErrorCode -2146828275 int

Is there anyone who was able to solve this problem?

Thank you & regards,
Jozsef

Nov 17 '05 #3

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

Similar topics

5
6818
by: John Davis | last post by:
When I create new documents in Dreamweaver, there are several choices for ASP creation: ASP JavaScript: run at client side?? ASP VBScript: run at server side?? ASP.NET C# ASP.NET VB I don't understand the differences between ASP JavaScript and ASP VBScript?? Because JavaScript is client-side technology, and ASP is server side technology. I think VBScript is used to implement ASP pages.
29
6009
by: Christopher Brandsdal | last post by:
If I have a .ASP page that runs JScript code - is it possible to include an ..ASP page that runs VBscript???
20
5960
by: Harag | last post by:
Hi All. I'm stating out doing some web developing. I was wondering which of the server side languages should I concentrate on and learn. I Know CSS, HTML, T-SQL I can look at the client javascript code and work out what it does but I can't really write it from scratch.
16
9339
by: Mike Schinkel | last post by:
Does anyone know if there are bugs in VBScript's GetRef()? I'm using VBScript Version 5.6.8515 on Win2003Server w/ASP. Sometimes it returns an object that VarType() says is a vbObject. Other times it returns VarType() is vbEmpty. This is driving me mad! Also, does anyone know what the properties and methods are for the object returned by GetRef()? TIA.
5
5189
by: gpence | last post by:
!!! Newbie question warning !!! I am somewhat familiar with javascript's ability to "access" the browser's favorites list -- for example, using window.home() will take you to the default URL -- is there any similar code for an ASP page using VBscript? I want my Logout button to take them back to their homepage. I've looked into Response.Redirect, but I can't seem to find a way to take the user out of my program to their home default. ...
4
12669
by: chris.dunigan | last post by:
I'm looking for an example of how to execute an existing DTS­ package from an ASP (VB)script and would appreciate any and all response. ­I don't even know if it's possible Thanks - Chuck Gatto Dan Guzman Apr 27 2000, 12:00 am show options
2
2847
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can anyone suggest a btter way of passing a session var into a vbscript function? <%@ Page language="c#" debug="true" ContentType="text/html"
7
13435
by: skeddy | last post by:
In a nutshell, I'm trying to dynamically create a select box with ResultSet code in vbscript and then need to be able to access the value of that select box later with a Save button. I've got the select box filling with code similar to below: <SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER> Public Sub BuildComboBox(rs, dispname, val, name, selected) 'rs = the recordset 'val = fieldname to place in the val of the option
10
4693
by: Shadow Lynx | last post by:
That subject packs a whallop, so let me explain in better detail what's happening and how it relates to ASPX pages... In a nutshell, if the first <script /on a page is of type "text/vbscript", you cannot use inline JavaScript statements that call setTimeout with functions that start with a double-underscore. This is very relavant to ASPX (ASP Dot Net) pages because it means that AutoPostBacks will fail since they generally call the...
6
1947
by: rishabhshrivastava | last post by:
Hello All, I am using ASP.NET 2.0 and I am experiencing a problem using vbscript that is this script on client side is preventing the postback of my controls. I have a dropdownlist which is supposed to perform some fucntion when the selected index is changed, it works fine without vbscript code(when i comment out that code) but when I uncomment the code the postback dosen't happen.
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8624
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
8336
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
8478
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
7164
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
5565
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
4082
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
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.