Code:
using System.Text;

using System.Windows.Forms;

using System.Security.Cryptography;

namespace CSharpMD5Hashing

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

        private void btn_Hash_Click(object sender, EventArgs e)

        {

            MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();

            byte[] hashedPassword;

            UTF8Encoding encoder= new UTF8Encoding();

            StringBuilder HashString = new System.Text.StringBuilder();

            hashedPassword  =  md5Hasher.ComputeHash(encoder.GetBytes(txt_TextToHash.Text));

            foreach (byte b in hashedPassword)

            {

                HashString.Append(b.ToString("x2"));

            }

            txt_HashedText.Text = Convert.ToString(HashString);

        }

    }

}
Source Code