Invoking Print Functionality

  • Thread starter Thread starter Gos
  • Start date Start date
G

Gos

Hi,

I have a grid which displays a list of files. The files can be of
any types. I also have a button on the form called "Print". If the
user has selected a word document and .bmp file, is there a way I can
invoke the print function of Word application for word document and
print function of Paint for .bmp file? I want to do the same thing for
any kind of file as long as the file has an application associated to
it.

I would appreciate any help.

Thank you
Gos
 
Look at ProcessStartInfo class and Process.Start method.
Allows you to execute a program with command line arguments. You will have
to figure out the commands for each program you want to print a document
for. This can be done in Windows' File Types.
 
(e-mail address removed) (Gos) scripsit:
I have a grid which displays a list of files. The files can be of
any types. I also have a button on the form called "Print". If the
user has selected a word document and .bmp file, is there a way I can
invoke the print function of Word application for word document and
print function of Paint for .bmp file? I want to do the same thing for
any kind of file as long as the file has an application associated to
it.

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.htm"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///
 
Back
Top