private void buttonSavePassword_Click(object sender, EventArgs e) { if (EditPasswordBox.Text.Length != 4) { MessageBox.Show("Введи 4 цифры для пароля", "Error"); EditPasswordBox.Focus(); DialogResult = DialogResult.None; return; } else { byte digit1 = Convert.ToByte(EditPasswordBox.Text[0].ToString()); byte digit2 = Convert.ToByte(EditPasswordBox.Text[1].ToString()); byte digit3 = Convert.ToByte(EditPasswordBox.Text[2].ToString()); byte digit4 = Convert.ToByte(EditPasswordBox.Text[3].ToString()); PasswordPultDUPaket = new byte[] { 1, digit1, digit2, digit3, digit4, 11, 11, 0, 0, 1, 0, 6, 255, 0x0D, 0x0A }; } }
private void FChangePasswordDU_Shown(object sender, EventArgs e) { EditPasswordBox.Clear(); EditPasswordBox.Focus(); }