tags:

views:

34

answers:

1

i have a textbox array using that i create 20 text boxes in runtime, i need to get the focus if a particular text box(if i press downarrow in keyboard how to get the key down of a particular text box it can be 3rd text box).

+2  A: 

You can add an Event-Handler to your KeyDown-Event:

yourTextboxArray[x].KeyDown += new KeyDownEventHandler(yourMethodHere);

The event has two parameters, sender (Object) and e (KeyDownEventArgs). You can use the sender to determine what Textbox has send the KeyDown.

Textbox txb_sender = sender as Textbox;
if(txb_sender != null)
      // do something here with it
Bobby