Form KeyDown Problem

  • Thread starter Thread starter Rasika WIJAYARATNE
  • Start date Start date
R

Rasika WIJAYARATNE

I have a form with a KeyDown event handler method attached to it. It
has three text boxes and two buttons (buttons are attached to event
handler). However when I debug, the form opens with the first text box
focussed, and when I press enter the Win XP 'Default Beep' sound plays
but does not fire the event handler (doesn't hit the break point inside
it). The event handler is definitely wired up to the form control, does
anyone know why this happens? Winforms using C++/CLI on .NET FW 2.0,
using Visual C++ Express for .NET 2.0.

Rasika.

I haven't set Form.AcceptButton or Form.CancelButton.
 
Rasika... I suspect the event is text changed or something like that so if
you just hit return the text has not changed.
 
The problem was the first textbox was focussed, so it wasn't firing the
form's keydown event handler. It worked for another form which is why I
couldn't figure out why it didnt work for this form, the reason they
other form worked was because it had a tab control and the tab was
focussed on form load, rather than a a text box. Thank you for you
feedback, it helped me to track this problem down.

Rasika.
 
Back
Top