Text file printout in dos mode through VB.Net or DOS command from VB.Net

H

Hardik Shah

Hi,

I am generating a text file through vb.net and I want to give facility to my
user to take DOS base (fast) printiout of it ,

or in other words,

I want to run DOS command from my application. i.e. TYPE C:\TEST.TXT >PRN ,
How can I ?

Regards,


Hardik Shah
 
C

Cor Ligthert [MVP]

Hardik,

Using proces here one which is longer it can be one line as well.

\\\
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = "www.google.com"
pi.WorkingDirectory = "C:\windows\system32"
'this for nt* computers
pi.FileName = "ping"
p.StartInfo = pi
p.StartInfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
MessageBox.Show(sb.ToString)
///

I hope this helps,

Cor
 
H

Herfried K. Wagner [MVP]

Hardik Shah said:
I am generating a text file through vb.net and I want to give facility to
my
user to take DOS base (fast) printiout of it ,

or in other words,

I want to run DOS command from my application. i.e. TYPE C:\TEST.TXT >PRN
,
How can I ?

Depending on the printer you may find the article below useful:

HOW TO: Send Raw Data to a Printer by Using Visual Basic .NET
<URL:http://support.microsoft.com/?scid=kb;EN-US;322090>
 

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

Top