Sunday, March 5, 2017

how to assign backspace as back key

Leave a Comment

I am Designing a windows form in which there is a picturebox which has back arrow image how to assign backspace key as direct shortcut to going back on previous form when current control is on form

1 Answers

Answers 1

Set the form property KeyPreview = true;. Then use the KeyDown-Event of the picturebox like this

private void picturebox1_KeyDown(object sender, KeyEventArgs e) {     if(e.KeyCode == Keys.Back) this.Close(); } 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment