How to do it...

  1. Start by adding a new Windows forms project to your solution.
  2. Call the project winformSecure and click on the OK button.
  3. In the Toolbox, search for the TextBox control and add it to your form.
  4. Lastly, add a button control to your form. You can resize this form, however you like to look more like a login form:
  1. With the textbox control selected on the Windows forms, open up the Properties panel and click on the Events button (it looks like a lightning bolt). In the Key group, double-click on the KeyPress event to create the handler in the code behind:

The code that is created for you is the KeyPress event handler for the ...

Get C# 7 and .NET Core Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.