Нужно вывести значение локальной переменной в другом методе c#
Вот мой код
public void buttonShifr_Click(object sender, EventArgs e)
{
var cipher = new VigenereCipher("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ");
var inputText = textBox1.Text;
var password = textBox3.Text;
encryptedText = cipher.Encrypt(inputText, password);
}
public void textBox2_TextChanged(object sender, EventArgs e)
{
TextBox.Show(encryptedText);
}
Ответы (1 шт):
Автор решения: aepot
→ Ссылка
Предположу, что вы хотели сделать что-то такое, вывести значение в textBox2.
public void buttonShifr_Click(object sender, EventArgs e)
{
var cipher = new VigenereCipher("АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ");
var inputText = textBox1.Text;
var password = textBox3.Text;
encryptedText = cipher.Encrypt(inputText, password);
textBox2.Text = encryptedText;
}
А обработчик события textBox2_TextChanged вам вообще не нужен.