C# college project enumeration -
C# college project enumeration -
i making easy calculator refresh starting college again. every thing working fine except trying assign keyboard ie. press plus adds, minus subtracts.
but when come in number , press add together button every thing right not clear text box of plus sign. why this?
private void tbone_keydown(object sender, keyeventargs e) { if (e.keycode == keys.add) { total1 += double.parse(tbone.text); tbtwo.text = tbone.text + btnplus.text; tbone.clear(); plusbuttonc = true; minusbuttonc = false; dividebutton = false; multiplybutton = false; } }
you need indicate event have handled key press prevent keypress beingness passed standard windows event handler. suppresskeypress prevent key beingness added text box. add together these lines:
e.handled = true; e.suppresskeypress = true;
it's worth noting setting suppresskeypress
sets handled
, explicit.
as noted @grantwinney in comments, if wpf need set handled
.
c#
Comments
Post a Comment