Password Protection Using Code in Windows Forms

Here, I will explain how to do password protection in code. Before that I suugest you see the explanation in Tutorial 2 Creating Login Form with SQL Server in Windows Forms.

Step 1: Create a login form.

 
Create a login Form

First create a Login form as I showed in Tutorial 2.

Step 2:
Coding

Coding

using
System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Data.SqlClient;

 

namespace First_Csharp_app

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

            pass_txt.passwordChar = '$'; //without this you can also do it by text box property as "UseSystemPasswordChar".

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            //Coding

        }

    }

} 

Step 3: Output

Output
You can also go to my blog dotnet-munesh.blogspot.

Up Next
    Ebook Download
    View all
    Learn
    View all