What's the alternative for this.ActiveControl property

  • Thread starter Thread starter datamodel
  • Start date Start date
D

datamodel

I'm trying to put text in any control that currently has focus.
The Compact Framework does not seem to have the this.ActiveControl
property.
What's the alternative,

to assing a string to the .Text property of the currently focused
control?

Thanks.
 
You could have an event that captures the GotFocus event for each control
you are concerned with then add the text there:

this.TextBox1.GotFocus +=new System.EventHandler(TB_GotFocus);
this.TextBox2.GotFocus +=new System.EventHandler(TB_GotFocus);
this.TextBox3.GotFocus +=new System.EventHandler(TB_GotFocus);

private void TB_GotFocus(object sender, .......)
{
//changed the sender text here
}
 
Joseph, Tim,

Thank you very much for your replies. Your suggestions resolved the
issue.
 
Back
Top