Windows Forms: How to Encrypt and Decrypt a String in C#

By FoxLearn 6/2/2017 7:50:09 PM   7.18K
Encrypt/Decrypt string or password using Eramake.eCryptography library in C#

Step 1Click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "EncryptDecryptDemo" and then click OK

encrypt decrypt in c#Step 2: Right click on your project select Manage NuGet Packages -> Search eramake.ecryptography -> Install

eramake.ecryptographyStep 3: Design your form as below

encrypt decrypt in c#

Step 4: Add code to handle your form as below

using System;
using System.Windows.Forms;

namespace EncryptDecryptDemo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnEncrypt_Click(object sender, EventArgs e)
        {
            txtEncrypt.Text = Eramake.eCryptography.Encrypt(txtValue.Text);
        }

        private void btnDecrypt_Click(object sender, EventArgs e)
        {
            txtDecrypt.Text = Eramake.eCryptography.Decrypt(txtEncrypt.Text);
        }
    }
}

VIDEO TUTORIALS