Showing posts with label How to make Own notepad in Visual C sharp. Show all posts
Showing posts with label How to make Own notepad in Visual C sharp. Show all posts

Thursday, June 16, 2011

How to make Own notepad in Visual C sharp

Make Your Own Notepad
In this tutorial we will be making a simple C# Notepad with the option to Clear, Cut, Copy, Paste, Select All, Save, Open, and exit. I am using Visual Studio 2008 to make this tutorial, but you can use any C# editor that you like, although, we will be making a GUI so you probably want to use either Visual Studio or Visual C# to follow.
 All right, so now we can start making the GUI.

Step 1: Starting a new project.
To start a new project, goto File -> New Project -> Windows Form Application and name it whatever you want.

 You should get a blank GUI named Form1, if you do goto Step 2, if not post a reply and tell me what your problem is, I am glad to help.
Step 2: Making the GUI

For this Notepad application we are going to be using a RichTextBox for the editor. So, goto your Toolbox and select richTextBox and put it onto your application form (Make sure to leave room at the top for the menu).

 All right, now you have your editor area, but we need to make a menu for the people using your application to use some features, so add a MenuStrip and type in the first box "File". Then there will be a drop down box to add more stuff, add "New", then click the little down arrow on the next one and click Seperator, this will make a line seperating the different menu options. After the seperator add "Save File" and then "Open File", then a seperator, then "Exit".

 All right, now you have your File menu, now next to File make another called "Edit", then for this one add "Cut", "Copy", and "Paste", and Select All to the Edit menu.

 There, now your menu is finished, onto Step 3 where we finally start coding!

Step 3: Adding events to the menu
All right, so now we have our GUI, we can run it but the buttons don't do anything. That is because we have not programmed in the events for these buttons yet, now this might sound difficult to some of you, but Visual Studio and Visual C# make it very easy to do this, as it makes the event command for us, we just have to tell it what to do, so double click on the "New" menu item under the file menu and it should take you to some code, your code should look something like this,

Code:
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;
namespace Notepad

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        private void newToolStripMenuItem_Click(object sender, EventArgs e)

        {

             // This is where the code for the button click of "New" is going to go.

         }

    }

}

Ok, so now under the private void newToolStripMenuItem_Click we need to add this code,

Code:

richTextBox1.Clear();

AngularJS Basics - Part 1

                                                                  AngularJS What is AngularJS ·          Framework by googl...