Interesting Q

  • Thread starter Thread starter Vai2000
  • Start date Start date
V

Vai2000

Hi All, I have a VBScript that does a bunch of stuff except for 1, for that
I had to write a CS Application. I want to call that CS Application in the
VBScript and depending on the return code of the CSApp I need to execute a
step.
how can I get return codes out of CSApp in VBScript?

TIA
 
Vai2000 said:
Hi All, I have a VBScript that does a bunch of stuff except for 1, for
that
I had to write a CS Application. I want to call that CS Application in the
VBScript and depending on the return code of the CSApp I need to execute a
step.
how can I get return codes out of CSApp in VBScript?

TIA

Hrm, without testing, I dunno how to get the return code for a CSApp...but
is there a reason why you didn't make this a C# Class Library and just call
a function that returns the value(s) you want?

Mythran
 
Like I said have an existing VBScript which is in Production, its failing to
do that 1 thing for which CS is awesome...(DataTables) so I coded that
routine in CS Console App now the trick is to incorporate into the existing
VBS..I am open to writing the CSApp in VB.NET will that buy me anything?

TIA
 
Vai2000 said:
Hrm, without testing, I dunno how to get the return code for a
CSApp...but is there a reason why you didn't make this a C# Class
Library and just call a function that returns the value(s) you want?

Mythran

You'll have to expose your CSApp to COM to be able to use it in VBScript
 
Vai2000,

You will be limited to returning a numeric return code, and you will
return that from your Main method.

Then, you just call your program like you would call any other program
from VB script.

However, the other suggestions for exposing a COM component from .NET
are better alternatives.

Hope this helps.
 
I am open to writing the CSApp in VB.NET will that buy me anything?

VB.Net and C# are basically the same thing, so I think you have a plan
there. Mixing VBScript and .Net programming is going to be difficult at
best.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
If you push something hard enough,
it will fall over.
- Fudd's First Law of Opposition
 
chris martin said:
You'll have to expose your CSApp to COM to be able to use it in VBScript.

Yes, I was suggesting that this be done, as a class library. He can create
the class library assembly in VB.Net or C# or any other .Net language, make
it COM library, then he can call the method using VBScript using the
CreateObject function. From there, he can get a return value in any COM
form available, rather than just a return code (numeric).

He can also pass non-string values to the COM component. A console
application can only be passed string-based arguments (can be converted to
numeric value afterwards, or parsed and converted via serialization, but why
do this?).

Anywho, that's my suggestion for the OP :)

Mythran
 

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