The WinForms Notepad Project: First Steps (Premium)

In investigating the history of Windows application programming, I’ve renewed my interest in software development. To be clear, I’m many years removed from my time writing code, so I probably have as much to learn as anyone reading this series. That will be disappointing, I know, to some experienced developers. But for those looking to take the next step past the basic code examples I use in the Programming Windows series, this might be just the ticket. It’s something we can do together, basically.

A few ground rules.

First up, I’m not going to teach you the basics of any programming language. There are tremendous written and video resources for that, and I’ll point you to a few as needed, as we go.

For this initial project, I’m going to try to duplicate the Notepad application as faithfully as possible using the Windows Forms (WinForms) framework and the Visual Basic (VB) programming language. This combination, while somewhat out-of-date today, is probably the simplest and most readable for non-developers. Future projects will use more modern frameworks like Windows Presentation Foundation (WPF) and Universal Windows Platform (UWP) and C#, an inarguably superior language. I may even re-implement Notepad using WPF and C# (or whatever); we’ll see where this takes us.

I chose Notepad because for the same reason I chose WinForms and VB: It’s a simple application, though as you’ll see as we step through the process of creating our own version of it, there are still complexities and obstacles to overcome. As I write this, I’ve not yet duplicated Notepad on my own, so we’ll have to see how it goes. (I have worked up quite a bit of it, however.)

To get started, you’ll need Visual Studio 2019 Community, which is free and available from the Visual Studio website. In the Visual Studio Installer, be sure to select the “.NET desktop development” workload under “Windows.” This includes everything we’ll need to create a version of Notepad using WinForms and VB.

While that’s installing, let’s consider Notepad for a moment. It is indeed a simple application. So simple, in fact, that its main application window uses only three controls: A menu, a textblock of some kind, and a status bar. That’s it.

Well, that’s not really it, of course. The Notepad menu system is surprisingly dense, especially the File and Edit menus.

And Notepad can launch a variety of system dialogs, including Open, Save/Save As, and Font, plus its own About dialog. So there is a lot to wire up, and we’ll need to figure out the best way to create our own dialog.

Given the simplicity of this application, the way I’d start this off is to create the basic user interface first. That is, attach a menu, a textblock (or whatever), and a status bar to the main application window, called a form in this environment (a nod to the classic VB versions of the 1990s). Then, once that’s done, we can start filling in funct...

Gain unlimited access to Premium articles.

With technology shaping our everyday lives, how could we not dig deeper?

Thurrott Premium delivers an honest and thorough perspective about the technologies we use and rely on everyday. Discover deeper content as a Premium member.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC