I use notepad all the time, sometimes I just wanted to add one little feature, but it's not extendable so I can't. If I could just get my hands on the source code and if that source code was in C# I'd be set. So I decided to write a clone so I can do just that, and share it so that others could as well.
I attempted to make an exact clone and I think I did pretty good with two exceptions. One I decided I wanted a different icon so I can tell it apart from the actual notepad.
Two, the real notepad has header and footer information as part of the page setup. I didn't know how to do that since the page setup dialog is a system dialog.
Download Notepad Clone .NET Binary (exe)
Download Source Code
i am new to c sharp and i am working on studying it .
ReplyDeletei hav been trying to built a notepad step by step studying different things in the process. one thing i havent found is to code the close button.
its been done in your notepad
could you please help me by letting me kno how u programmed the close button
Hello KTBFFH, to answer your question accurately I would need details. But I'm guessing what you want is to get prompted to save your work if you try to close the application. The even you want to handle is the form close or closing event. It gives you an opportunity to cancel the close if you want. Note you can actually download the code and see exactly how I do it.
DeleteHello,
ReplyDeleteI made a similar clone of Notepad, for the same reasons, but mine was made in VB.Net, opposed to C#. Mine is available from Visual Studio's extension gallery. I think that you should go through the process to submit yours there as well. Your version has a lot more features than mine, as I couldn't manage to figure out the goto function and the status bar. I am currently working on a version that will include compiled HTML Help files, file encryption, a much improved replace all function(I just learned that string.replace existed), the goto feature, and other quirks available in MS Notepad; such as the .LOG function, and the different forms of encoding for files.
Its a really nice notepad clone. Good Work. Milan M.
ReplyDeleteThanks Milan! I'm glad you liked it.
DeleteThis comment has been removed by the author.
ReplyDeleteI am impressed by your work but I question the use of the word "clone", which is an exact copy. I am very interested in this subject because I also love Notepad but needed some additional functionality.
ReplyDeletehttp://www.codeproject.com/Tips/563711/Encrypting-Editor-Notepad-replacement
http://www.frank-t-clark.com/Professional/Papers/CryptPad/CryptPad.html
I am constantly puzzled and frustrated by differences between my program's operation compared to Notepad, which I am having great difficulty overcoming. I have consulted many different attempts by different people to make a clone or replacement. Almost all are very poor attempts. When I discovered your efforts I was impressed by how nearly complete your solution is.
Hey Frank, thanks for taking the time to write.
DeleteI checked out CryptPad it's very good and it works as advertised.
I tried my best to mimic Windows Notepad as much as possible and I'm open to any suggestions on how I can better accomplish that.
LOL! The only solution I have found is to test, scratch my head, and write some more code. It is very time consuming and sometimes the solution is not clear. Notepad does some surprisingly sophisticated things. For example, the Undo function in Notepad has functionality not implemented in the standard Texbox control. Very difficult to duplicate without writing some massive code. Your program does not properly read files with ANSI characters as Notepad does. You don't support encoding coversions, which Notepad does. Lots of little details. (Heavy sigh)
DeleteVery interesting, thanks Frank, I had no idea Notepad had all those features. I'll have to look into them, it will be an interesting challenge.
DeleteHey Frank, I added support for encoding conversion. While the actual encoding seems to be happening correctly, it doesn't seem to be displayed the same way as notepad.
DeleteThe .NET code for detecting encoding seem to be able to distinguish between ANSI and UTF-8.
This is definitely going to be a challenge.
In the meanwhile I updated the files attached to this article with those changes.
Quick update, I fixed the ANSI detection.
Delete"It will be an interesting challenge."
DeleteWhat an understatement! The challenges seem to never end. The more I test my program the more differences I find and the harder it gets to correct them. Currently I am trying to figure out how to get the Edit, Delete function to Undo without writing a massive amount of code to brute force a solution. I believe there must be some simple procedure Notepad uses to get the textbox class to do the work, but I haven't found it yet.
I believe I have found the solution. It appears you should never directly modify the textbox.SelectedText but use textbox.Paste (str); instead.
DeleteThat's great! Thanks for sharing.
DeleteHey i am new to Coding and c# so can you please make a Visual studio project for me instead of the source codes, so that i can open the project and run it and then edit it, thanks so much
ReplyDeleteHey Ash, There is no "solution" file packed with the source code, but there is a .csproj file. You should be able to open that file in Visual Studio to compile and run the project. Let me know if that works for you. Thanks.
Deleteok thanks, Can you please help me with one more thing. So my question is that you know how you have the file name on your Notepad Cloned up top that's opened, so i was wondering if u can help me with that on Visual Basic.
DeletePlease Help
Thanks Ash
hello every1
ReplyDeletevl u plz gv me a code fr impltion of save, save as, print preview, pade setup fxn of notepad
Hey Rajesh, all the code is available for download. Just click on the "Download Source Code" at the end of the blog post.
Delete