Skip to main content

How to create a windows form to open a pdf file using c#

How to create windows form to open a pdf file using c#




to open a pdf file in c# we need to use ProcessStartInfo method which inside System.Diagnostic
to make windows form to open a pdf file using c# follow these steps :

Step 1 - open visual studio and goto new project



Step 2 - select c# and windows form application



Step 3 - add a button in the form



Step 4 - open the form code and add using System.Diagnostic; in namespaces



Step 5 - write the code for string variable which holds the values as pdf file path



Step 6 - write the code for ProcessStarInfo method



Step 7 - pass the string variable to start the process
output

this is the output


you can open any pdf using these steps also you can use the open file dialog from the toolbox to select pdf file to open by a user.

Comments

Popular Posts

How to create a error message box using notepad

How to create a message box using notepad Step 1- open notepad Step 2- Write this code on notepad X=Msgbox("Press OK.",1+16,"Demo Error") note- in the above code instead of double quoted text you can write anything you want Step 3- save this file as .vbs Step 4- open the ".vbs" file

#How to create your own Run command(Windows+R) to open desired applications.

#How to create your own Run command(Windows+R) to open desired applications. Many times we use shortcuts to open a particular application, we normally place application icon on desktop but sometimes it gets hard to find particular application or program to avoid such situation we use a simple command to open that application using Run window (Windwos+R). Now Let's see how to make our own command to open the desired application.   Step1:- Right Click on Desktop and select New-->Shortcut step2:- Either Type: netbeans.exe or browse to the .exe file of a program if it cannot find .exe by  typing and then click next step3:- after that write any name which you will like to use as a command for opening that program example-NetBeans step4:- then go to the Run(Windows+R) type \Windows and enter the windows folder will open paste the shortcut file that we have created into this folder that's it now let's check your own command o...