Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi Friends,

I have some 10 number of textbox and a button, consider my cursor is blinking in 5th textbox. when i click the button ,i should find in which textbox the cursor was and write some text in that textbox.. i dono how to detect the focused textbox..
Posted

You can't detect the previous focussed textbox - because it is no longer focussed - but you can handle the TextBox.Leave event and set a variable to tell you which one it was.
C#
private TextBox lastLeft;
private void myTextBoxes_Leave(object sender, EventArgs e)
    {
    lastLeft = sender as TextBox;
    }
 
Share this answer
 
It's possibly indexed as 0 or 1, check html code!
Modify all indexed controls...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900