was successfully added to your cart.

Is WinForms Dead?

Is WinForms Dead?

By April 13, 2018 Ask Tim 2 Comments

Looking at the Established Choice vs. the New UIs

Windows Forms or WinForms has been around since the beginning of .NET (and before that with VB6) so the question makes sense. We have WPF and UWP now so why would we ever create a WinForm project? It seems like WinForms is only for legacy support. That all sounds logical, however, it is just not true. Microsoft has maintained and improved WinForms (and there are some cool new features coming down the road). Their commitment to WinForms has remained steady. The reason for this is because WinForms fills a need that the other user interfaces do not: it is simple.

Look at WPF for a minute. If you create a new application, and you do it “right” (the way it was designed to be used), you will need to learn to use XAML. Then you need to start looking at binding. Then, to really do it right, you should consider MVVM (like I do here: https://youtu.be/laPFq3Fhs8k). Compare that to a WinForm app. Want to use drag and drop for the controls? Sure, that was what it was designed for. Need to assign a value to a control? No problem. Just specify Control.Text = “<your value>” and you are all set. Can you do this in WPF? Absolutely. The difference is that WinForms were designed to be built this way. WPF was designed to permit this but as a compromise rather than a primary way of doing things.

Beyond this, though, I use WinForms when I want to teach a simple UI technique (even my C# Application from Start to Finish course falls in this category). I want to have as little UI “stuff” to explain as possible. That is where WinForms shines. No, I am not teaching the latest and greatest UI but that isn’t the point a lot of the time. The problem is people get caught up thinking that the UI is the code. They are two different things. If I am teaching C# code, the UI I choose is the simplest possible so it stays out of the way of the true topic.

Finally, and this is really important, there are a LOT of companies that use WinForms in production today. In fact, at a recent conference I was at with a large group of C# consultants. When the audience was polled on which desktop UIs their clients were using, the vast majority were WinForms, a small group was WPF, and almost no one was UWP. So if you plan on using C# at a place of employment, WinForms is still a HUGE deal.

Join the discussion 2 Comments

  • Harag says:

    Small, but to the point! Great blog – I develop in WinForms everyday, the application I look after if over 10 years old now, but we still use the latest version of .NET. I started with WinForms way back with VB3. I don’t think it will die as it’s a very easy to use and create an application.

  • Chuck says:

    I think it’s important to keep reminding people (I’m looking at you, whipper snapper) of these facts. The development blogosphere is so enamored with everything shiny and new that the tried and true often gets short shrift. Enterprise architects, in particular, need to think long-term when designing new solutions. I highly doubt that the latest Javascript Framework du Jour will still be around in ten years, but it’s pretty safe to assume that WinForms and other well established development frameworks will be. Perhaps one JS SPA framework will eventually win out in the enterprise and become standard, but as of right now I would not recommend one over another for a new project with an expected lifetime of more than a few years. Heck, I know of VB6 line-of-business applications that are still in operation today, and they are working fine. There is no business case to replace them. If it ain’t broke, don’t fix it.

Leave a Reply