By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,552 Members | 927 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,552 IT Pros & Developers. It's quick & easy.

VB6-> VB.net .. problems

P: n/a
Hi,

I know VB6 pretty well but has just started to work on VB.net.

I am experiencing problems during my tests and I wonder if someone can
advise me.

Q1: I use the Shell function to run external 'console' programs. These
console programs display information on the screen while working.
Because I use the shell function, I would like to be able to grab what the
'console displays' on the screen to see if this console program works fine.
I basically tried to run something like 'c:\Consoleprog.exe > prog.txt' but
I never get the prog.txt with the shell function. It works fin in command
line.
So : Is it the best way to do what I want to do ? (I don't think so)
What is going on ?

Q2: I have a VB.net Service. This service is working fine. I would like to
create a function in my service that can be called from a script (.vbs). I
wonder what is the best and most simple option. Com ? Other ?
If you can advise me (because it is a service) and give me a sample code to
test this.

Thanks for you help.

Regards
SN
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

Answer to question 1

Dim pi As New ProcessStartInfo

Dim p As Process

pi.RedirectStandardOutput = True

pi.FileName = "c:\pubsconsole.exe"

pi.UseShellExecute = False

Dim sw As New System.IO.StreamWriter("C:\MyOutPut.txt")

p = Process.Start(pi)

sw.WriteLine(p.StandardOutput.ReadToEnd)

p.WaitForExit()

sw.Close()

Ken

------------------------------------

"Snoop" <Sn***@discussions.microsoft.com> wrote in message
news:F5**********************************@microsof t.com...
Hi,

I know VB6 pretty well but has just started to work on VB.net.

I am experiencing problems during my tests and I wonder if someone can
advise me.

Q1: I use the Shell function to run external 'console' programs. These
console programs display information on the screen while working.
Because I use the shell function, I would like to be able to grab what the
'console displays' on the screen to see if this console program works fine.
I basically tried to run something like 'c:\Consoleprog.exe > prog.txt' but
I never get the prog.txt with the shell function. It works fin in command
line.
So : Is it the best way to do what I want to do ? (I don't think so)
What is going on ?

Q2: I have a VB.net Service. This service is working fine. I would like to
create a function in my service that can be called from a script (.vbs). I
wonder what is the best and most simple option. Com ? Other ?
If you can advise me (because it is a service) and give me a sample code to
test this.

Thanks for you help.

Regards
SN
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.