I am deriving a class from TextBox to implement a NumericBox. I am
overriding OnGotFocus and OnLostFocus methods but On GotFocus is causing
problems. Actually the commented lines are causing problems. These throw
Win32 exception that windows was unable to create handle. I dunno wats
wrong. Plz help

protected override void OnGotFocus(EventArgs e)
{
//this.TextAlign=HorizontalAlignment.Left;
//this.SelectionStart=base.Text.Length;
base.OnGotFocus(e);
}

protected override void OnLostFocus(EventArgs e)
{
this.TextAlign=HorizontalAlignment.Right;
base.OnLostFocus(e);
}

Re: OnGotFocus Problem by Mubashir

Mubashir
Tue Sep 06 02:52:00 CDT 2005

I have used OnEnter and OnLeave too. It works fine but TextAlign property is
causing problem. Any Clues ???

"Mubashir Khan" <mmubashirkhan@yahoo.com> wrote in message
news:ewaW3$qsFHA.2072@TK2MSFTNGP14.phx.gbl...
> I am deriving a class from TextBox to implement a NumericBox. I am
> overriding OnGotFocus and OnLostFocus methods but On GotFocus is causing
> problems. Actually the commented lines are causing problems. These throw
> Win32 exception that windows was unable to create handle. I dunno wats
> wrong. Plz help
>
> protected override void OnGotFocus(EventArgs e)
> {
> //this.TextAlign=HorizontalAlignment.Left;
> //this.SelectionStart=base.Text.Length;
> base.OnGotFocus(e);
> }
>
> protected override void OnLostFocus(EventArgs e)
> {
> this.TextAlign=HorizontalAlignment.Right;
> base.OnLostFocus(e);
> }
>
>