Creating Notepad Using Windows Form Application in Visual Studio 2017

INTRODUCTION

In this article, am going to explain how to create Notepad Application in Visual Studio 2017.Iam going to use some common controls available in c# and design Notepad in c#.

C# 

CONTROL FUNCTIONS 

Some Controls used in Notepad Development are,
  1. Menu strip
  2. content Menu strip 
  3. Rich Textbox
Step 1
  1. Open Visual Studio and Start the New Project .
  2. Change the following Property as,

    • Give it a name
    • Add appropriate icon and set backcolour as control.
C#

Step 2

Now drag and drop the MenuStrip from the control window and add the required menu items and their icons.We can add menu strip directly by drag and drop or at run time. The Menustrip control is new to this version of Visual Studio and the .NET Framework.With the help of Menustrip ,you can easily create menus like those found in Microsoft Office.

C# 

Step3

Drag and drop the Rich Textbox from the toolbox in the form.Set the dock property as fill .so that the size of Rich Textbox is changed according with size of the form.By using the Richtextbox control,user can enter and edit the text.The Control provide advanced Feature than normal Textbox contol.

Form look like as,

C#

C#

Step 4 

Drag and drop the Context Menustrip from the toolbox in the form.Context menu can be used with any control,right clicking he mouse shows the shortcut menu.Here ContextMenuStrip assosiated with the Rich Textbox control for the purpose of copy,paste,undo,Redo etc

C#

Step 5 

Code for Context Menu strip as shown in the screenshot given below,

C# 

Now Compile and Run the following Output appear as shown in the screenshot given below.We can able to copy,Paste,Undo and Redo the Text in Notepad

C# 

Step 6

Now we discuss the code for Open Function.The openfiledialog control is used in the code.The main Function of Openfiledialog control use to browse data from the computer. So whenever the open option is clicked it will browse Data from the Computer and displays the selected file in notepad.

C# 

Now Compile and Run ,the following Output appear as shown in the screenshot given below.We can able to Open the file from the computer in Notepad.

C# 

Step 7

Now we discuss the code for SaveFunction.The savefiledialog control is used in the code.The main Function of savefiledialog control allow the user to save a file by specific name at Specific Location and type. So whenever the Save option is clicked it will Save File to the Computer.

C# 

Now Compile and Run, the following Output appear as shown in the screenshot given below.We can able to Save the file to the computer.

C# 

Summary

Hope this article is usefull for creating Notepad in Visual Studio 2017 ,Thanks for reading my article.


Similar Articles