473,395 Members | 2,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

View and Print using ProcessStartInfo

Hi Group,

I have the following code, but not sure if this is write, I would like to be
able with the View code, for the document to be opened eg. C:\test.Doc and
with the PRint button for it to Autmatically Print.

The code I have so far is:

Private Sub btnViewDoc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnViewDoc.Click
Dim View As New System.Diagnostics.ProcessStartInfo()
View.Verb = "View"
View.WindowStyle = ProcessWindowStyle.Maximized
View.FileName = txtFileLocation.Text
View.UseShellExecute = True
System.Diagnostics.Process.Start(View)
End Sub

Private Sub btnPrintDoc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPrintDoc.Click
Dim Print As New System.Diagnostics.ProcessStartInfo()
Print.Verb = "Print"
Print.WindowStyle = ProcessWindowStyle.Hidden
Print.FileName = txtFileLocation.Text
Print.UseShellExecute = True
System.Diagnostics.Process.Start(Print)
End Sub

When i try and view or peint using the code I get a error saying:

Additional information: No application is associated with the specified file
for this operation

Any kind person able to point me in the right direction?

Many Thanks
MCN
Nov 21 '05 #1
0 1687

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

Similar topics

4
by: Greg | last post by:
The following dos command creates a text file of all active computers in the domain: net view > c:\test.txt However the following code does not create the text file. Any idea why this is? The...
6
by: gizmo | last post by:
I have a requirement to initiate more than one instance of an application using the filenames. (the example below will start two instances of MS Word). My problem is that I need to kill each...
1
by: TD | last post by:
I'm using iText in an app to create and print documents to network printers. I launch acrobat via the command line as shown on this page... ...
1
by: Wendy | last post by:
I read Herfried Wagner's code from 12/05. I can get the following to work to open a web page: Dim psi As New ProcessStartInfo() With psi .FileName = "iexplore" .Arguments = "-new...
1
by: brogdon | last post by:
I'm attempting to build an ASP.NET (VB) application that will do server-side printing of PDF files. I have used a Process object to launch Adobe's AcroRd32 program with the /t switch which causes...
5
by: Brad Pears | last post by:
I have the following code which I was using to print .pdf's. It worked fine and actually printed the pdf file. Now I want to use the same code to print a .jpg file. When I run the code, it...
0
by: =?Utf-8?B?VG9kZE0=?= | last post by:
I am trying the print an html document using Process.Start with the verb "print", which works except it displays the print dialog box. The printer is set correctly to the one specified using the...
1
by: Rick | last post by:
Can anyone tell me how to set the printer using the process class in VB.net, I've tried everything, it always goes to the default printer. My Code: Dim pathToExecutable As String =...
0
by: subhash123 | last post by:
no error mesage come for print related , but say print successfully but there is not print any pages, my code for print is String pathToExecutable = @"C:\Program Files\Adobe\Reader...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...

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.