string word = textBox1.Text; char[] array = word.ToCharArray(); string encoded = ""; for (int i = 0; i < array.Length; i++) { int idx = char.ToUpper(array[i]) - 64; string translate = idx.ToString(); if (idx < 10) translate = "0" + idx.ToString(); encoded = encoded + translate; } //MessageBox.Show(encoded); textBox2.Text = encoded;