Hey guys I've been struggling with my code ! I did some research and I don't understand why my code isn't working... Please help !
private void CheckEnter(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
Debug.WriteLine("It's working!");
enterKey = true;
}
else
{
enterKey = false;
}
}
private void textBox_TextChanged(object sender, TextChangedEventArgs e)
{
Debug.WriteLine("The text is changing");
if (enterKey == true)
{
encryptKey = encryptInTextBox.Text;
Debug.WriteLine("The key is " + encryptKey);
}
}
Apparently I can't change 'TextChangedEvenArgs' because of how the text box was created, whenever I change it, it comes with an error. So, I decided to do it this way, thanks for the help !
为什么不直接在文本框KEYPRESS或KEYUP事件中检查ENTER键?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.