In this article, you will learn how to print a text file in C#.
Step 1
Create a Windows Forms application using Visual Studio and add two Button and one TextBox controls to the Form. Change names for the Buttons to Browse and Print respectively.
Step 2
Write the following code on the Browse button click event handler.
Step 3
Before we write code on the Print button click event handler, define two private variables on class level.
Now import these two namespaces.
Write the following code on Print button click event handler.
And add the following method to the class.
Step 4