Working with Stream Reader and Stream Writer class in C# .net

Blog Author


Published Date

15th October, 2020




  • Share this blog :


Working with Stream Reader and Stream Writer class:-

  1. Stream Reader is used to read the data from a file.
  2. Stream Writer is used to write the data information in to file.

Methods of Stream Reader and Stream Writer classes:-


String S = “String /n ; 

String /n………..” Write (“abc”);

Write (“xyz”);

Abc  xyz  

What is DOCK?

  1. This is a property, which is available for all visible controls.
  2. Dock property resizes a control Relatively with form Size.

What is the Anchor?

  1. Anchor property repositions a control relatively with form size 
  • Developing An application like a notepad
  • Options required in note pad

  File                   Edit                  Format                         Help

New                 Select All            Fonts                      Help topics

Open                   Cut                   Colors                      About

Save                    Copy

Print                     Paste


  The following controls are required to develop a notepad  

  1. Text Box
  2. Menu Strip
  3. Open File Dialog
  4. Save File Dialog
  5. Print Dialog
  6. Color Dialog
  7. Font Dialog

   Interested in mastering .NET? Learn more about ".NET Training" in this blog post.

  • Open windows Forms Application Project name my note
  • Place all above 7 controls on the form
  • Choose text box arrrowpropertiesarrrow

Multiline = true

Dock = fill

Scrollbars = both

Allow drop = true

  • Select Menu strip control and design it with the above-discussed options
  • Assigning an Icon   to a menu item

Right click on new arrrowset Image arrrowchoose an image

  • Assigning a short – cut key

Right click on cut arrrow properties arrrow short cut key

  • Select a combination

Check Out .Net Tutorial


Using System . Io;

Using System . Drawing .Printing


Code for new menu Item  (double click on new)


Text Box1. Text = “”;


Code for  open menu Item


Open File Dialog 1. Show Dialog ();

String p = Open File Dialog 1. File Name;

Message box. Show  (p);

Stream Reader sr = new Stream Reader  (p);

Text box 1 .text = sr. Read To end ();

Sr. close ();


Code for save menu item


Save File Dialog 1. Show Dialog ();

String p = Save File Dialog 1 .File Name;

Stream Writer sw = new Stream Writer (p);

Sw. Write  (text box1. text);

Sw. Flush ();

Sw. Close ();


Code for Print


Printer Setting ps = new Printer Settings ();

Print Dialog 1 .Printer Strings = ps;

Print Dialog1. Show Dialog ();


Code for exit {

Application .Exit ();


Code for Select ALL


Text box1.Select ALL();


Code for cut

text box 1.cut ();

  • Code for copy

text box1.copy ();

  • Code for paste

textbox1.paste ();

  • Code for Fonts

Font Dialog1.Show Dialog (); Text box 1. Font = font Dialog1. Font;

  • Code for colors

{ Color Dialog1. Show Dialog (); Text Box 1.fore color Dialog1. Color; }

  • Code for Help Topics

Label L =new label ();

Dock = Dock Style .Fill ;
Font = new Font (“Arial”, 20)
Text = “ Type Help messages here” ;
Form f = new Form ();

control S .Add (L);
Show Dialog ();


View menu arrrow Solution Explorer arrrowright-click on my note (project name) arrrowadd à new itemarrrowAbout box and provide the name test  

Code for About

Test t = new Test ();

Show ();
About Author


Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .

Related Blogs

Write For Us